<?xml version='1.0' encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link href="cpip.css" rel="stylesheet" type="text/css" />
    <title>File: /Users/paulross/dev/Python-3.6.2/Include/unicodeobject.h</title>
  </head>
  <body>
    <h1>File: /Users/paulross/dev/Python-3.6.2/Include/unicodeobject.h</h1>
    <p>Green shading in the line number column
means the source is part of the translation unit, red means it is conditionally excluded.
Highlighted line numbers link to the translation unit page. Highlighted macros link to
the macro page.</p>
    <pre><a name="1" /><span class="True">       1:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="macros_noref.html#_UHlfVU5JQ09ERU9CSkVDVF9IXzA_"><span class="b">Py_UNICODEOBJECT_H</span></a>
<a name="2" /><span class="True">       2:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERU9CSkVDVF9IXzA_"><span class="b">Py_UNICODEOBJECT_H</span></a>
<a name="3" /><span class="True">       3:</span> 
<a name="4" /><span class="True">       4:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">stdarg</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="5" /><span class="True">       5:</span> 
<a name="6" /><span class="True">       6:</span> <span class="k">/*</span>
<a name="7" /><span class="True">       7:</span> <span class="k"></span>
<a name="8" /><span class="True">       8:</span> <span class="k">Unicode implementation based on original code by Fredrik Lundh,</span>
<a name="9" /><span class="True">       9:</span> <span class="k">modified by Marc-Andre Lemburg (mal@lemburg.com) according to the</span>
<a name="10" /><span class="True">      10:</span> <span class="k">Unicode Integration Proposal. (See</span>
<a name="11" /><span class="True">      11:</span> <span class="k">http://www.egenix.com/files/python/unicode-proposal.txt).</span>
<a name="12" /><span class="True">      12:</span> <span class="k"></span>
<a name="13" /><span class="True">      13:</span> <span class="k">Copyright (c) Corporation for National Research Initiatives.</span>
<a name="14" /><span class="True">      14:</span> <span class="k"></span>
<a name="15" /><span class="True">      15:</span> <span class="k"></span>
<a name="16" /><span class="True">      16:</span> <span class="k"> Original header:</span>
<a name="17" /><span class="True">      17:</span> <span class="k"> --------------------------------------------------------------------</span>
<a name="18" /><span class="True">      18:</span> <span class="k"></span>
<a name="19" /><span class="True">      19:</span> <span class="k"> * Yet another Unicode string type for Python.  This type supports the</span>
<a name="20" /><span class="True">      20:</span> <span class="k"> * 16-bit Basic Multilingual Plane (BMP) only.</span>
<a name="21" /><span class="True">      21:</span> <span class="k"> *</span>
<a name="22" /><span class="True">      22:</span> <span class="k"> * Written by Fredrik Lundh, January 1999.</span>
<a name="23" /><span class="True">      23:</span> <span class="k"> *</span>
<a name="24" /><span class="True">      24:</span> <span class="k"> * Copyright (c) 1999 by Secret Labs AB.</span>
<a name="25" /><span class="True">      25:</span> <span class="k"> * Copyright (c) 1999 by Fredrik Lundh.</span>
<a name="26" /><span class="True">      26:</span> <span class="k"> *</span>
<a name="27" /><span class="True">      27:</span> <span class="k"> * fredrik@pythonware.com</span>
<a name="28" /><span class="True">      28:</span> <span class="k"> * http://www.pythonware.com</span>
<a name="29" /><span class="True">      29:</span> <span class="k"> *</span>
<a name="30" /><span class="True">      30:</span> <span class="k"> * --------------------------------------------------------------------</span>
<a name="31" /><span class="True">      31:</span> <span class="k"> * This Unicode String Type is</span>
<a name="32" /><span class="True">      32:</span> <span class="k"> *</span>
<a name="33" /><span class="True">      33:</span> <span class="k"> * Copyright (c) 1999 by Secret Labs AB</span>
<a name="34" /><span class="True">      34:</span> <span class="k"> * Copyright (c) 1999 by Fredrik Lundh</span>
<a name="35" /><span class="True">      35:</span> <span class="k"> *</span>
<a name="36" /><span class="True">      36:</span> <span class="k"> * By obtaining, using, and/or copying this software and/or its</span>
<a name="37" /><span class="True">      37:</span> <span class="k"> * associated documentation, you agree that you have read, understood,</span>
<a name="38" /><span class="True">      38:</span> <span class="k"> * and will comply with the following terms and conditions:</span>
<a name="39" /><span class="True">      39:</span> <span class="k"> *</span>
<a name="40" /><span class="True">      40:</span> <span class="k"> * Permission to use, copy, modify, and distribute this software and its</span>
<a name="41" /><span class="True">      41:</span> <span class="k"> * associated documentation for any purpose and without fee is hereby</span>
<a name="42" /><span class="True">      42:</span> <span class="k"> * granted, provided that the above copyright notice appears in all</span>
<a name="43" /><span class="True">      43:</span> <span class="k"> * copies, and that both that copyright notice and this permission notice</span>
<a name="44" /><span class="True">      44:</span> <span class="k"> * appear in supporting documentation, and that the name of Secret Labs</span>
<a name="45" /><span class="True">      45:</span> <span class="k"> * AB or the author not be used in advertising or publicity pertaining to</span>
<a name="46" /><span class="True">      46:</span> <span class="k"> * distribution of the software without specific, written prior</span>
<a name="47" /><span class="True">      47:</span> <span class="k"> * permission.</span>
<a name="48" /><span class="True">      48:</span> <span class="k"> *</span>
<a name="49" /><span class="True">      49:</span> <span class="k"> * SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO</span>
<a name="50" /><span class="True">      50:</span> <span class="k"> * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND</span>
<a name="51" /><span class="True">      51:</span> <span class="k"> * FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR</span>
<a name="52" /><span class="True">      52:</span> <span class="k"> * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES</span>
<a name="53" /><span class="True">      53:</span> <span class="k"> * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN</span>
<a name="54" /><span class="True">      54:</span> <span class="k"> * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT</span>
<a name="55" /><span class="True">      55:</span> <span class="k"> * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</span>
<a name="56" /><span class="True">      56:</span> <span class="k"> * -------------------------------------------------------------------- */</span>
<a name="57" /><span class="True">      57:</span> 
<a name="58" /><span class="True">      58:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">ctype</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="59" /><span class="True">      59:</span> 
<a name="60" /><span class="True">      60:</span> <span class="k">/* === Internal API ======================================================= */</span>
<a name="61" /><span class="True">      61:</span> 
<a name="62" /><span class="True">      62:</span> <span class="k">/* --- Internal Unicode Format -------------------------------------------- */</span>
<a name="63" /><span class="True">      63:</span> 
<a name="64" /><span class="True">      64:</span> <span class="k">/* Python 3.x requires unicode */</span>
<a name="65" /><span class="True">      65:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVVNJTkdfVU5JQ09ERV8w"><span class="b">Py_USING_UNICODE</span></a>
<a name="66" /><span class="True">      66:</span> 
<a name="67" /><span class="False">      67:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="macros_ref.html#_U0laRU9GX1dDSEFSX1RfMA__"><span class="b">SIZEOF_WCHAR_T</span></a>
<a name="68" /><span class="False">      68:</span> <span class="f">#</span><span class="n">error</span> <span class="b">Must</span> <span class="b">define</span> <a href="macros_ref.html#_U0laRU9GX1dDSEFSX1RfMA__"><span class="b">SIZEOF_WCHAR_T</span></a>
<a name="69" /><span class="True">      69:</span> <span class="f">#</span><span class="n">endif</span>
<a name="70" /><span class="True">      70:</span> 
<a name="71" /><span class="True">      71:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_ref.html#_UHlfVU5JQ09ERV9TSVpFXzA_"><span class="b">Py_UNICODE_SIZE</span></a> <a href="macros_ref.html#_U0laRU9GX1dDSEFSX1RfMA__"><span class="b">SIZEOF_WCHAR_T</span></a>
<a name="72" /><span class="True">      72:</span> 
<a name="73" /><span class="True">      73:</span> <span class="k">/* If wchar_t can be used for UCS-4 storage, set Py_UNICODE_WIDE.</span>
<a name="74" /><span class="True">      74:</span> <span class="k">   Otherwise, Unicode strings are stored as UCS-2 (with limited support</span>
<a name="75" /><span class="True">      75:</span> <span class="k">   for UTF-16) */</span>
<a name="76" /><span class="True">      76:</span> 
<a name="77" /><span class="True">      77:</span> <span class="f">#</span><span class="n">if</span> <a href="macros_ref.html#_UHlfVU5JQ09ERV9TSVpFXzA_"><span class="b">Py_UNICODE_SIZE</span></a> <span class="f">&gt;=</span> <span class="c">4</span>
<a name="78" /><span class="True">      78:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9XSURFXzA_"><span class="b">Py_UNICODE_WIDE</span></a>
<a name="79" /><span class="True">      79:</span> <span class="f">#</span><span class="n">endif</span>
<a name="80" /><span class="True">      80:</span> 
<a name="81" /><span class="True">      81:</span> <span class="k">/* Set these flags if the platform has &quot;wchar.h&quot; and the</span>
<a name="82" /><span class="True">      82:</span> <span class="k">   wchar_t type is a 16-bit unsigned type */</span>
<a name="83" /><span class="True">      83:</span> <span class="k">/* #define HAVE_WCHAR_H */</span>
<a name="84" /><span class="True">      84:</span> <span class="k">/* #define HAVE_USABLE_WCHAR_T */</span>
<a name="85" /><span class="True">      85:</span> 
<a name="86" /><span class="True">      86:</span> <span class="k">/* Py_UNICODE was the native Unicode storage format (code unit) used by</span>
<a name="87" /><span class="True">      87:</span> <span class="k">   Python and represents a single Unicode element in the Unicode type.</span>
<a name="88" /><span class="True">      88:</span> <span class="k">   With PEP 393, Py_UNICODE is deprecated and replaced with a</span>
<a name="89" /><span class="True">      89:</span> <span class="k">   typedef to wchar_t. */</span>
<a name="90" /><span class="True">      90:</span> 
<a name="91" /><span class="True">      91:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="92" /><span class="True">      92:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UFlfVU5JQ09ERV9UWVBFXzA_"><span class="b">PY_UNICODE_TYPE</span></a> <span class="m">wchar_t</span>
<a name="93" /><span class="True">      93:</span> <span class="m">typedef</span> <span class="m">wchar_t</span> <span class="b">Py_UNICODE</span><span class="f">;</span>
<a name="94" /><span class="True">      94:</span> <span class="f">#</span><span class="n">endif</span>
<a name="95" /><span class="True">      95:</span> 
<a name="96" /><span class="True">      96:</span> <span class="k">/* If the compiler provides a wchar_t type we try to support it</span>
<a name="97" /><span class="True">      97:</span> <span class="k">   through the interface functions PyUnicode_FromWideChar(),</span>
<a name="98" /><span class="True">      98:</span> <span class="k">   PyUnicode_AsWideChar() and PyUnicode_AsWideCharString(). */</span>
<a name="99" /><span class="True">      99:</span> 
<a name="100" /><span class="False">     100:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">HAVE_USABLE_WCHAR_T</span>
<a name="101" /><span class="False">     101:</span> <span class="f">#</span> <span class="n">ifndef</span> <a href="macros_ref.html#_SEFWRV9XQ0hBUl9IXzA_"><span class="b">HAVE_WCHAR_H</span></a>
<a name="102" /><span class="False">     102:</span> <span class="f">#</span>  <span class="n">define</span> <a href="macros_ref.html#_SEFWRV9XQ0hBUl9IXzA_"><span class="b">HAVE_WCHAR_H</span></a>
<a name="103" /><span class="False">     103:</span> <span class="f">#</span> <span class="n">endif</span>
<a name="104" /><span class="True">     104:</span> <span class="f">#</span><span class="n">endif</span>
<a name="105" /><span class="True">     105:</span> 
<a name="106" /><span class="True">     106:</span> <span class="f">#</span><span class="n">ifdef</span> <a href="macros_ref.html#_SEFWRV9XQ0hBUl9IXzA_"><span class="b">HAVE_WCHAR_H</span></a>
<a name="107" /><span class="True">     107:</span> <span class="k">/* Work around a cosmetic bug in BSDI 4.x wchar.h; thanks to Thomas Wouters */</span>
<a name="108" /><span class="False">     108:</span> <span class="f">#</span> <span class="n">ifdef</span> <span class="b">_HAVE_BSDI</span>
<a name="109" /><span class="False">     109:</span> <span class="f">#</span>  <span class="n">include</span> <span class="f">&lt;</span><span class="b">time</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="110" /><span class="True">     110:</span> <span class="f">#</span> <span class="n">endif</span>
<a name="111" /><span class="True">     111:</span> <span class="f">#</span>  <span class="n">include</span> <span class="f">&lt;</span><span class="b">wchar</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="112" /><span class="True">     112:</span> <span class="f">#</span><span class="n">endif</span>
<a name="113" /><span class="True">     113:</span> 
<a name="114" /><span class="True">     114:</span> <span class="k">/* Py_UCS4 and Py_UCS2 are typedefs for the respective</span>
<a name="115" /><span class="True">     115:</span> <span class="k">   unicode representations. */</span>
<a name="116" /><span class="True">     116:</span> <span class="m">typedef</span> <span class="b">uint32_t</span> <span class="b">Py_UCS4</span><span class="f">;</span>
<a name="117" /><span class="True">     117:</span> <span class="m">typedef</span> <span class="b">uint16_t</span> <span class="b">Py_UCS2</span><span class="f">;</span>
<a name="118" /><span class="True">     118:</span> <span class="m">typedef</span> <span class="b">uint8_t</span> <span class="b">Py_UCS1</span><span class="f">;</span>
<a name="119" /><span class="True">     119:</span> 
<a name="120" /><span class="True">     120:</span> <span class="k">/* --- Internal Unicode Operations ---------------------------------------- */</span>
<a name="121" /><span class="True">     121:</span> 
<a name="122" /><span class="True">     122:</span> <span class="k">/* Since splitting on whitespace is an important use case, and</span>
<a name="123" /><span class="True">     123:</span> <span class="k">   whitespace in most situations is solely ASCII whitespace, we</span>
<a name="124" /><span class="True">     124:</span> <span class="k">   optimize for the common case by using a quick look-up table</span>
<a name="125" /><span class="True">     125:</span> <span class="k">   _Py_ascii_whitespace (see below) with an inlined check.</span>
<a name="126" /><span class="True">     126:</span> <span class="k"></span>
<a name="127" /><span class="True">     127:</span> <span class="k"> */</span>
<a name="128" /><span class="True">     128:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="129" /><span class="True">     129:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU1NQQUNFXzA_"><span class="b">Py_UNICODE_ISSPACE</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> \
<a name="130" /><span class="True">     130:</span>     <span class="f">(</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">&lt;</span> <span class="c">128U</span> <span class="f">?</span> <span class="b">_Py_ascii_whitespace</span><span class="f">[</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span><span class="f">]</span> <span class="f">:</span> <span class="b">_PyUnicode_IsWhitespace</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span><span class="f">)</span>
<a name="131" /><span class="True">     131:</span> 
<a name="132" /><span class="True">     132:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU0xPV0VSXzA_"><span class="b">Py_UNICODE_ISLOWER</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_IsLowercase</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="133" /><span class="True">     133:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU1VQUEVSXzA_"><span class="b">Py_UNICODE_ISUPPER</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_IsUppercase</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="134" /><span class="True">     134:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU1RJVExFXzA_"><span class="b">Py_UNICODE_ISTITLE</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_IsTitlecase</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="135" /><span class="True">     135:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU0xJTkVCUkVBS18w"><span class="b">Py_UNICODE_ISLINEBREAK</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_IsLinebreak</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="136" /><span class="True">     136:</span> 
<a name="137" /><span class="True">     137:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9UT0xPV0VSXzA_"><span class="b">Py_UNICODE_TOLOWER</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_ToLowercase</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="138" /><span class="True">     138:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9UT1VQUEVSXzA_"><span class="b">Py_UNICODE_TOUPPER</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_ToUppercase</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="139" /><span class="True">     139:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9UT1RJVExFXzA_"><span class="b">Py_UNICODE_TOTITLE</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_ToTitlecase</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="140" /><span class="True">     140:</span> 
<a name="141" /><span class="True">     141:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU0RFQ0lNQUxfMA__"><span class="b">Py_UNICODE_ISDECIMAL</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_IsDecimalDigit</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="142" /><span class="True">     142:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU0RJR0lUXzA_"><span class="b">Py_UNICODE_ISDIGIT</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_IsDigit</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="143" /><span class="True">     143:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU05VTUVSSUNfMA__"><span class="b">Py_UNICODE_ISNUMERIC</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_IsNumeric</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="144" /><span class="True">     144:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU1BSSU5UQUJMRV8w"><span class="b">Py_UNICODE_ISPRINTABLE</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_IsPrintable</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="145" /><span class="True">     145:</span> 
<a name="146" /><span class="True">     146:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9UT0RFQ0lNQUxfMA__"><span class="b">Py_UNICODE_TODECIMAL</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_ToDecimalDigit</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="147" /><span class="True">     147:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9UT0RJR0lUXzA_"><span class="b">Py_UNICODE_TODIGIT</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_ToDigit</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="148" /><span class="True">     148:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9UT05VTUVSSUNfMA__"><span class="b">Py_UNICODE_TONUMERIC</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_ToNumeric</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="149" /><span class="True">     149:</span> 
<a name="150" /><span class="True">     150:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU0FMUEhBXzA_"><span class="b">Py_UNICODE_ISALPHA</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="b">_PyUnicode_IsAlpha</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span>
<a name="151" /><span class="True">     151:</span> 
<a name="152" /><span class="True">     152:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU0FMTlVNXzA_"><span class="b">Py_UNICODE_ISALNUM</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> \
<a name="153" /><span class="True">     153:</span>        <span class="f">(</span><a href="macros_noref.html#_UHlfVU5JQ09ERV9JU0FMUEhBXzA_"><span class="b">Py_UNICODE_ISALPHA</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">||</span> \
<a name="154" /><span class="True">     154:</span>     <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU0RFQ0lNQUxfMA__"><span class="b">Py_UNICODE_ISDECIMAL</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">||</span> \
<a name="155" /><span class="True">     155:</span>     <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU0RJR0lUXzA_"><span class="b">Py_UNICODE_ISDIGIT</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">||</span> \
<a name="156" /><span class="True">     156:</span>     <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU05VTUVSSUNfMA__"><span class="b">Py_UNICODE_ISNUMERIC</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span><span class="f">)</span>
<a name="157" /><span class="True">     157:</span> 
<a name="158" /><span class="True">     158:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9DT1BZXzA_"><span class="b">Py_UNICODE_COPY</span></a><span class="f">(</span><span class="b">target</span><span class="f">,</span> <span class="b">source</span><span class="f">,</span> <span class="b">length</span><span class="f">)</span> \
<a name="159" /><span class="True">     159:</span>     <a href="macros_noref.html#_bWVtY3B5XzA_"><span class="b">memcpy</span></a><span class="f">(</span><span class="f">(</span><span class="b">target</span><span class="f">)</span><span class="f">,</span> <span class="f">(</span><span class="b">source</span><span class="f">)</span><span class="f">,</span> <span class="f">(</span><span class="b">length</span><span class="f">)</span><span class="f">*</span><span class="m">sizeof</span><span class="f">(</span><span class="b">Py_UNICODE</span><span class="f">)</span><span class="f">)</span>
<a name="160" /><span class="True">     160:</span> 
<a name="161" /><span class="True">     161:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9GSUxMXzA_"><span class="b">Py_UNICODE_FILL</span></a><span class="f">(</span><span class="b">target</span><span class="f">,</span> <span class="b">value</span><span class="f">,</span> <span class="b">length</span><span class="f">)</span> \
<a name="162" /><span class="True">     162:</span>     <span class="m">do</span> <span class="f">{</span><span class="b">Py_ssize_t</span> <span class="b">i_</span><span class="f">;</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">t_</span> <span class="f">=</span> <span class="f">(</span><span class="b">target</span><span class="f">)</span><span class="f">;</span> <span class="b">Py_UNICODE</span> <span class="b">v_</span> <span class="f">=</span> <span class="f">(</span><span class="b">value</span><span class="f">)</span><span class="f">;\
</span>        <span class="m">for</span> <span class="f">(</span><span class="b">i_</span> <span class="f">=</span> <span class="c">0</span><span class="f">;</span> <span class="b">i_</span> <span class="f">&lt;</span> <span class="f">(</span><span class="b">length</span><span class="f">)</span><span class="f">;</span> <span class="b">i_</span><span class="f">++</span><span class="f">)</span> <span class="b">t_</span><span class="f">[</span><span class="b">i_</span><span class="f">]</span> <span class="f">=</span> <span class="b">v_</span><span class="f">;\
</span>    <span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="165" /><span class="True">     165:</span> 
<a name="166" /><span class="True">     166:</span> <span class="k">/* macros to work with surrogates */</span>
<a name="167" /><span class="True">     167:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU19TVVJST0dBVEVfMA__"><span class="b">Py_UNICODE_IS_SURROGATE</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">(</span><span class="c">0xD800</span> <span class="f">&lt;=</span> <span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">&amp;&amp;</span> <span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">&lt;=</span> <span class="c">0xDFFF</span><span class="f">)</span>
<a name="168" /><span class="True">     168:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU19ISUdIX1NVUlJPR0FURV8w"><span class="b">Py_UNICODE_IS_HIGH_SURROGATE</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">(</span><span class="c">0xD800</span> <span class="f">&lt;=</span> <span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">&amp;&amp;</span> <span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">&lt;=</span> <span class="c">0xDBFF</span><span class="f">)</span>
<a name="169" /><span class="True">     169:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9JU19MT1dfU1VSUk9HQVRFXzA_"><span class="b">Py_UNICODE_IS_LOW_SURROGATE</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">(</span><span class="c">0xDC00</span> <span class="f">&lt;=</span> <span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">&amp;&amp;</span> <span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">&lt;=</span> <span class="c">0xDFFF</span><span class="f">)</span>
<a name="170" /><span class="True">     170:</span> <span class="k">/* Join two surrogate characters and return a single Py_UCS4 value. */</span>
<a name="171" /><span class="True">     171:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9KT0lOX1NVUlJPR0FURVNfMA__"><span class="b">Py_UNICODE_JOIN_SURROGATES</span></a><span class="f">(</span><span class="b">high</span><span class="f">,</span> <span class="b">low</span><span class="f">)</span>  \
<a name="172" /><span class="True">     172:</span>     <span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">Py_UCS4</span><span class="f">)</span><span class="f">(</span><span class="b">high</span><span class="f">)</span> <span class="f">&amp;</span> <span class="c">0x03FF</span><span class="f">)</span> <span class="f">&lt;&lt;</span> <span class="c">10</span><span class="f">)</span> <span class="f">|</span>      \
<a name="173" /><span class="True">     173:</span>       <span class="f">(</span><span class="f">(</span><span class="b">Py_UCS4</span><span class="f">)</span><span class="f">(</span><span class="b">low</span><span class="f">)</span> <span class="f">&amp;</span> <span class="c">0x03FF</span><span class="f">)</span><span class="f">)</span> <span class="f">+</span> <span class="c">0x10000</span><span class="f">)</span>
<a name="174" /><span class="True">     174:</span> <span class="k">/* high surrogate = top 10 bits added to D800 */</span>
<a name="175" /><span class="True">     175:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9ISUdIX1NVUlJPR0FURV8w"><span class="b">Py_UNICODE_HIGH_SURROGATE</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">(</span><span class="c">0xD800</span> <span class="f">-</span> <span class="f">(</span><span class="c">0x10000</span> <span class="f">&gt;&gt;</span> <span class="c">10</span><span class="f">)</span> <span class="f">+</span> <span class="f">(</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">&gt;&gt;</span> <span class="c">10</span><span class="f">)</span><span class="f">)</span>
<a name="176" /><span class="True">     176:</span> <span class="k">/* low surrogate = bottom 10 bits added to DC00 */</span>
<a name="177" /><span class="True">     177:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9MT1dfU1VSUk9HQVRFXzA_"><span class="b">Py_UNICODE_LOW_SURROGATE</span></a><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">(</span><span class="c">0xDC00</span> <span class="f">+</span> <span class="f">(</span><span class="f">(</span><span class="b">ch</span><span class="f">)</span> <span class="f">&amp;</span> <span class="c">0x3FF</span><span class="f">)</span><span class="f">)</span>
<a name="178" /><span class="True">     178:</span> 
<a name="179" /><span class="True">     179:</span> <span class="k">/* Check if substring matches at given offset.  The offset must be</span>
<a name="180" /><span class="True">     180:</span> <span class="k">   valid, and the substring must not be empty. */</span>
<a name="181" /><span class="True">     181:</span> 
<a name="182" /><span class="True">     182:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9NQVRDSF8w"><span class="b">Py_UNICODE_MATCH</span></a><span class="f">(</span><span class="b">string</span><span class="f">,</span> <span class="b">offset</span><span class="f">,</span> <span class="b">substring</span><span class="f">)</span> \
<a name="183" /><span class="True">     183:</span>     <span class="f">(</span><span class="f">(</span><span class="f">*</span><span class="f">(</span><span class="f">(</span><span class="b">string</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr</span> <span class="f">+</span> <span class="f">(</span><span class="b">offset</span><span class="f">)</span><span class="f">)</span> <span class="f">==</span> <span class="f">*</span><span class="f">(</span><span class="f">(</span><span class="b">substring</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr</span><span class="f">)</span><span class="f">)</span> <span class="f">&amp;&amp;</span> \
<a name="184" /><span class="True">     184:</span>      <span class="f">(</span><span class="f">(</span><span class="f">*</span><span class="f">(</span><span class="f">(</span><span class="b">string</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr</span> <span class="f">+</span> <span class="f">(</span><span class="b">offset</span><span class="f">)</span> <span class="f">+</span> <span class="f">(</span><span class="b">substring</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr_length</span><span class="f">-</span><span class="c">1</span><span class="f">)</span> <span class="f">==</span> <span class="f">*</span><span class="f">(</span><span class="f">(</span><span class="b">substring</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr</span> <span class="f">+</span> <span class="f">(</span><span class="b">substring</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr_length</span><span class="f">-</span><span class="c">1</span><span class="f">)</span><span class="f">)</span><span class="f">)</span> <span class="f">&amp;&amp;</span> \
<a name="185" /><span class="True">     185:</span>      <span class="f">!</span><span class="b">memcmp</span><span class="f">(</span><span class="f">(</span><span class="b">string</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr</span> <span class="f">+</span> <span class="f">(</span><span class="b">offset</span><span class="f">)</span><span class="f">,</span> <span class="f">(</span><span class="b">substring</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr</span><span class="f">,</span> <span class="f">(</span><span class="b">substring</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr_length</span><span class="f">*</span><span class="m">sizeof</span><span class="f">(</span><span class="b">Py_UNICODE</span><span class="f">)</span><span class="f">)</span><span class="f">)</span>
<a name="186" /><span class="True">     186:</span> 
<a name="187" /><span class="True">     187:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* Py_LIMITED_API */</span>
<a name="188" /><span class="True">     188:</span> 
<a name="189" /><span class="False">     189:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">__cplusplus</span>
<a name="190" /><span class="False">     190:</span> <span class="m">extern</span> <span class="e">&quot;C&quot;</span> <span class="f">{</span>
<a name="191" /><span class="True">     191:</span> <span class="f">#</span><span class="n">endif</span>
<a name="192" /><span class="True">     192:</span> 
<a name="193" /><span class="True">     193:</span> <span class="k">/* --- Unicode Type ------------------------------------------------------- */</span>
<a name="194" /><span class="True">     194:</span> 
<a name="195" /><span class="True">     195:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="196" /><span class="True">     196:</span> 
<a name="197" /><span class="True">     197:</span> <span class="k">/* ASCII-only strings created through PyUnicode_New use the PyASCIIObject</span>
<a name="198" /><span class="True">     198:</span> <span class="k">   structure. state.ascii and state.compact are set, and the data</span>
<a name="199" /><span class="True">     199:</span> <span class="k">   immediately follow the structure. utf8_length and wstr_length can be found</span>
<a name="200" /><span class="True">     200:</span> <span class="k">   in the length field; the utf8 pointer is equal to the data pointer. */</span>
<a name="201" /><span class="True">     201:</span> <span class="m">typedef</span> <span class="m">struct</span> <span class="f">{</span>
<a name="202" /><span class="True">     202:</span>     <span class="k">/* There are 4 forms of Unicode strings:</span>
<a name="203" /><span class="True">     203:</span> <span class="k"></span>
<a name="204" /><span class="True">     204:</span> <span class="k">       - compact ascii:</span>
<a name="205" /><span class="True">     205:</span> <span class="k"></span>
<a name="206" /><span class="True">     206:</span> <span class="k">         * structure = PyASCIIObject</span>
<a name="207" /><span class="True">     207:</span> <span class="k">         * test: PyUnicode_IS_COMPACT_ASCII(op)</span>
<a name="208" /><span class="True">     208:</span> <span class="k">         * kind = PyUnicode_1BYTE_KIND</span>
<a name="209" /><span class="True">     209:</span> <span class="k">         * compact = 1</span>
<a name="210" /><span class="True">     210:</span> <span class="k">         * ascii = 1</span>
<a name="211" /><span class="True">     211:</span> <span class="k">         * ready = 1</span>
<a name="212" /><span class="True">     212:</span> <span class="k">         * (length is the length of the utf8 and wstr strings)</span>
<a name="213" /><span class="True">     213:</span> <span class="k">         * (data starts just after the structure)</span>
<a name="214" /><span class="True">     214:</span> <span class="k">         * (since ASCII is decoded from UTF-8, the utf8 string are the data)</span>
<a name="215" /><span class="True">     215:</span> <span class="k"></span>
<a name="216" /><span class="True">     216:</span> <span class="k">       - compact:</span>
<a name="217" /><span class="True">     217:</span> <span class="k"></span>
<a name="218" /><span class="True">     218:</span> <span class="k">         * structure = PyCompactUnicodeObject</span>
<a name="219" /><span class="True">     219:</span> <span class="k">         * test: PyUnicode_IS_COMPACT(op) &amp;&amp; !PyUnicode_IS_ASCII(op)</span>
<a name="220" /><span class="True">     220:</span> <span class="k">         * kind = PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND or</span>
<a name="221" /><span class="True">     221:</span> <span class="k">           PyUnicode_4BYTE_KIND</span>
<a name="222" /><span class="True">     222:</span> <span class="k">         * compact = 1</span>
<a name="223" /><span class="True">     223:</span> <span class="k">         * ready = 1</span>
<a name="224" /><span class="True">     224:</span> <span class="k">         * ascii = 0</span>
<a name="225" /><span class="True">     225:</span> <span class="k">         * utf8 is not shared with data</span>
<a name="226" /><span class="True">     226:</span> <span class="k">         * utf8_length = 0 if utf8 is NULL</span>
<a name="227" /><span class="True">     227:</span> <span class="k">         * wstr is shared with data and wstr_length=length</span>
<a name="228" /><span class="True">     228:</span> <span class="k">           if kind=PyUnicode_2BYTE_KIND and sizeof(wchar_t)=2</span>
<a name="229" /><span class="True">     229:</span> <span class="k">           or if kind=PyUnicode_4BYTE_KIND and sizeof(wchar_t)=4</span>
<a name="230" /><span class="True">     230:</span> <span class="k">         * wstr_length = 0 if wstr is NULL</span>
<a name="231" /><span class="True">     231:</span> <span class="k">         * (data starts just after the structure)</span>
<a name="232" /><span class="True">     232:</span> <span class="k"></span>
<a name="233" /><span class="True">     233:</span> <span class="k">       - legacy string, not ready:</span>
<a name="234" /><span class="True">     234:</span> <span class="k"></span>
<a name="235" /><span class="True">     235:</span> <span class="k">         * structure = PyUnicodeObject</span>
<a name="236" /><span class="True">     236:</span> <span class="k">         * test: kind == PyUnicode_WCHAR_KIND</span>
<a name="237" /><span class="True">     237:</span> <span class="k">         * length = 0 (use wstr_length)</span>
<a name="238" /><span class="True">     238:</span> <span class="k">         * hash = -1</span>
<a name="239" /><span class="True">     239:</span> <span class="k">         * kind = PyUnicode_WCHAR_KIND</span>
<a name="240" /><span class="True">     240:</span> <span class="k">         * compact = 0</span>
<a name="241" /><span class="True">     241:</span> <span class="k">         * ascii = 0</span>
<a name="242" /><span class="True">     242:</span> <span class="k">         * ready = 0</span>
<a name="243" /><span class="True">     243:</span> <span class="k">         * interned = SSTATE_NOT_INTERNED</span>
<a name="244" /><span class="True">     244:</span> <span class="k">         * wstr is not NULL</span>
<a name="245" /><span class="True">     245:</span> <span class="k">         * data.any is NULL</span>
<a name="246" /><span class="True">     246:</span> <span class="k">         * utf8 is NULL</span>
<a name="247" /><span class="True">     247:</span> <span class="k">         * utf8_length = 0</span>
<a name="248" /><span class="True">     248:</span> <span class="k"></span>
<a name="249" /><span class="True">     249:</span> <span class="k">       - legacy string, ready:</span>
<a name="250" /><span class="True">     250:</span> <span class="k"></span>
<a name="251" /><span class="True">     251:</span> <span class="k">         * structure = PyUnicodeObject structure</span>
<a name="252" /><span class="True">     252:</span> <span class="k">         * test: !PyUnicode_IS_COMPACT(op) &amp;&amp; kind != PyUnicode_WCHAR_KIND</span>
<a name="253" /><span class="True">     253:</span> <span class="k">         * kind = PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND or</span>
<a name="254" /><span class="True">     254:</span> <span class="k">           PyUnicode_4BYTE_KIND</span>
<a name="255" /><span class="True">     255:</span> <span class="k">         * compact = 0</span>
<a name="256" /><span class="True">     256:</span> <span class="k">         * ready = 1</span>
<a name="257" /><span class="True">     257:</span> <span class="k">         * data.any is not NULL</span>
<a name="258" /><span class="True">     258:</span> <span class="k">         * utf8 is shared and utf8_length = length with data.any if ascii = 1</span>
<a name="259" /><span class="True">     259:</span> <span class="k">         * utf8_length = 0 if utf8 is NULL</span>
<a name="260" /><span class="True">     260:</span> <span class="k">         * wstr is shared with data.any and wstr_length = length</span>
<a name="261" /><span class="True">     261:</span> <span class="k">           if kind=PyUnicode_2BYTE_KIND and sizeof(wchar_t)=2</span>
<a name="262" /><span class="True">     262:</span> <span class="k">           or if kind=PyUnicode_4BYTE_KIND and sizeof(wchar_4)=4</span>
<a name="263" /><span class="True">     263:</span> <span class="k">         * wstr_length = 0 if wstr is NULL</span>
<a name="264" /><span class="True">     264:</span> <span class="k"></span>
<a name="265" /><span class="True">     265:</span> <span class="k">       Compact strings use only one memory block (structure + characters),</span>
<a name="266" /><span class="True">     266:</span> <span class="k">       whereas legacy strings use one block for the structure and one block</span>
<a name="267" /><span class="True">     267:</span> <span class="k">       for characters.</span>
<a name="268" /><span class="True">     268:</span> <span class="k"></span>
<a name="269" /><span class="True">     269:</span> <span class="k">       Legacy strings are created by PyUnicode_FromUnicode() and</span>
<a name="270" /><span class="True">     270:</span> <span class="k">       PyUnicode_FromStringAndSize(NULL, size) functions. They become ready</span>
<a name="271" /><span class="True">     271:</span> <span class="k">       when PyUnicode_READY() is called.</span>
<a name="272" /><span class="True">     272:</span> <span class="k"></span>
<a name="273" /><span class="True">     273:</span> <span class="k">       See also _PyUnicode_CheckConsistency().</span>
<a name="274" /><span class="True">     274:</span> <span class="k">    */</span>
<a name="275" /><span class="True">     275:</span>     <a href="macros_ref.html#_UHlPYmplY3RfSEVBRF8w"><span class="b">PyObject_HEAD</span></a>
<a name="276" /><span class="True">     276:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">;</span>          <span class="k">/* Number of code points in the string */</span>
<a name="277" /><span class="True">     277:</span>     <span class="b">Py_hash_t</span> <span class="b">hash</span><span class="f">;</span>             <span class="k">/* Hash value; -1 if not set */</span>
<a name="278" /><span class="True">     278:</span>     <span class="m">struct</span> <span class="f">{</span>
<a name="279" /><span class="True">     279:</span>         <span class="k">/*</span>
<a name="280" /><span class="True">     280:</span> <span class="k">           SSTATE_NOT_INTERNED (0)</span>
<a name="281" /><span class="True">     281:</span> <span class="k">           SSTATE_INTERNED_MORTAL (1)</span>
<a name="282" /><span class="True">     282:</span> <span class="k">           SSTATE_INTERNED_IMMORTAL (2)</span>
<a name="283" /><span class="True">     283:</span> <span class="k"></span>
<a name="284" /><span class="True">     284:</span> <span class="k">           If interned != SSTATE_NOT_INTERNED, the two references from the</span>
<a name="285" /><span class="True">     285:</span> <span class="k">           dictionary to this object are *not* counted in ob_refcnt.</span>
<a name="286" /><span class="True">     286:</span> <span class="k">         */</span>
<a name="287" /><span class="True">     287:</span>         <span class="m">unsigned</span> <span class="m">int</span> <span class="b">interned</span><span class="f">:</span><span class="c">2</span><span class="f">;</span>
<a name="288" /><span class="True">     288:</span>         <span class="k">/* Character size:</span>
<a name="289" /><span class="True">     289:</span> <span class="k"></span>
<a name="290" /><span class="True">     290:</span> <span class="k">           - PyUnicode_WCHAR_KIND (0):</span>
<a name="291" /><span class="True">     291:</span> <span class="k"></span>
<a name="292" /><span class="True">     292:</span> <span class="k">             * character type = wchar_t (16 or 32 bits, depending on the</span>
<a name="293" /><span class="True">     293:</span> <span class="k">               platform)</span>
<a name="294" /><span class="True">     294:</span> <span class="k"></span>
<a name="295" /><span class="True">     295:</span> <span class="k">           - PyUnicode_1BYTE_KIND (1):</span>
<a name="296" /><span class="True">     296:</span> <span class="k"></span>
<a name="297" /><span class="True">     297:</span> <span class="k">             * character type = Py_UCS1 (8 bits, unsigned)</span>
<a name="298" /><span class="True">     298:</span> <span class="k">             * all characters are in the range U+0000-U+00FF (latin1)</span>
<a name="299" /><span class="True">     299:</span> <span class="k">             * if ascii is set, all characters are in the range U+0000-U+007F</span>
<a name="300" /><span class="True">     300:</span> <span class="k">               (ASCII), otherwise at least one character is in the range</span>
<a name="301" /><span class="True">     301:</span> <span class="k">               U+0080-U+00FF</span>
<a name="302" /><span class="True">     302:</span> <span class="k"></span>
<a name="303" /><span class="True">     303:</span> <span class="k">           - PyUnicode_2BYTE_KIND (2):</span>
<a name="304" /><span class="True">     304:</span> <span class="k"></span>
<a name="305" /><span class="True">     305:</span> <span class="k">             * character type = Py_UCS2 (16 bits, unsigned)</span>
<a name="306" /><span class="True">     306:</span> <span class="k">             * all characters are in the range U+0000-U+FFFF (BMP)</span>
<a name="307" /><span class="True">     307:</span> <span class="k">             * at least one character is in the range U+0100-U+FFFF</span>
<a name="308" /><span class="True">     308:</span> <span class="k"></span>
<a name="309" /><span class="True">     309:</span> <span class="k">           - PyUnicode_4BYTE_KIND (4):</span>
<a name="310" /><span class="True">     310:</span> <span class="k"></span>
<a name="311" /><span class="True">     311:</span> <span class="k">             * character type = Py_UCS4 (32 bits, unsigned)</span>
<a name="312" /><span class="True">     312:</span> <span class="k">             * all characters are in the range U+0000-U+10FFFF</span>
<a name="313" /><span class="True">     313:</span> <span class="k">             * at least one character is in the range U+10000-U+10FFFF</span>
<a name="314" /><span class="True">     314:</span> <span class="k">         */</span>
<a name="315" /><span class="True">     315:</span>         <span class="m">unsigned</span> <span class="m">int</span> <span class="b">kind</span><span class="f">:</span><span class="c">3</span><span class="f">;</span>
<a name="316" /><span class="True">     316:</span>         <span class="k">/* Compact is with respect to the allocation scheme. Compact unicode</span>
<a name="317" /><span class="True">     317:</span> <span class="k">           objects only require one memory block while non-compact objects use</span>
<a name="318" /><span class="True">     318:</span> <span class="k">           one block for the PyUnicodeObject struct and another for its data</span>
<a name="319" /><span class="True">     319:</span> <span class="k">           buffer. */</span>
<a name="320" /><span class="True">     320:</span>         <span class="m">unsigned</span> <span class="m">int</span> <span class="b">compact</span><span class="f">:</span><span class="c">1</span><span class="f">;</span>
<a name="321" /><span class="True">     321:</span>         <span class="k">/* The string only contains characters in the range U+0000-U+007F (ASCII)</span>
<a name="322" /><span class="True">     322:</span> <span class="k">           and the kind is PyUnicode_1BYTE_KIND. If ascii is set and compact is</span>
<a name="323" /><span class="True">     323:</span> <span class="k">           set, use the PyASCIIObject structure. */</span>
<a name="324" /><span class="True">     324:</span>         <span class="m">unsigned</span> <span class="m">int</span> <span class="b">ascii</span><span class="f">:</span><span class="c">1</span><span class="f">;</span>
<a name="325" /><span class="True">     325:</span>         <span class="k">/* The ready flag indicates whether the object layout is initialized</span>
<a name="326" /><span class="True">     326:</span> <span class="k">           completely. This means that this is either a compact object, or</span>
<a name="327" /><span class="True">     327:</span> <span class="k">           the data pointer is filled out. The bit is redundant, and helps</span>
<a name="328" /><span class="True">     328:</span> <span class="k">           to minimize the test in PyUnicode_IS_READY(). */</span>
<a name="329" /><span class="True">     329:</span>         <span class="m">unsigned</span> <span class="m">int</span> <span class="b">ready</span><span class="f">:</span><span class="c">1</span><span class="f">;</span>
<a name="330" /><span class="True">     330:</span>         <span class="k">/* Padding to ensure that PyUnicode_DATA() is always aligned to</span>
<a name="331" /><span class="True">     331:</span> <span class="k">           4 bytes (see issue #19537 on m68k). */</span>
<a name="332" /><span class="True">     332:</span>         <span class="m">unsigned</span> <span class="m">int</span> <span class="f">:</span><span class="c">24</span><span class="f">;</span>
<a name="333" /><span class="True">     333:</span>     <span class="f">}</span> <span class="b">state</span><span class="f">;</span>
<a name="334" /><span class="True">     334:</span>     <span class="m">wchar_t</span> <span class="f">*</span><span class="b">wstr</span><span class="f">;</span>              <span class="k">/* wchar_t representation (null-terminated) */</span>
<a name="335" /><span class="True">     335:</span> <span class="f">}</span> <span class="b">PyASCIIObject</span><span class="f">;</span>
<a name="336" /><span class="True">     336:</span> 
<a name="337" /><span class="True">     337:</span> <span class="k">/* Non-ASCII strings allocated through PyUnicode_New use the</span>
<a name="338" /><span class="True">     338:</span> <span class="k">   PyCompactUnicodeObject structure. state.compact is set, and the data</span>
<a name="339" /><span class="True">     339:</span> <span class="k">   immediately follow the structure. */</span>
<a name="340" /><span class="True">     340:</span> <span class="m">typedef</span> <span class="m">struct</span> <span class="f">{</span>
<a name="341" /><span class="True">     341:</span>     <span class="b">PyASCIIObject</span> <span class="b">_base</span><span class="f">;</span>
<a name="342" /><span class="True">     342:</span>     <span class="b">Py_ssize_t</span> <span class="b">utf8_length</span><span class="f">;</span>     <span class="k">/* Number of bytes in utf8, excluding the</span>
<a name="343" /><span class="True">     343:</span> <span class="k">                                 * terminating \0. */</span>
<a name="344" /><span class="True">     344:</span>     <span class="m">char</span> <span class="f">*</span><span class="b">utf8</span><span class="f">;</span>                 <span class="k">/* UTF-8 representation (null-terminated) */</span>
<a name="345" /><span class="True">     345:</span>     <span class="b">Py_ssize_t</span> <span class="b">wstr_length</span><span class="f">;</span>     <span class="k">/* Number of code points in wstr, possible</span>
<a name="346" /><span class="True">     346:</span> <span class="k">                                 * surrogates count as two code points. */</span>
<a name="347" /><span class="True">     347:</span> <span class="f">}</span> <span class="b">PyCompactUnicodeObject</span><span class="f">;</span>
<a name="348" /><span class="True">     348:</span> 
<a name="349" /><span class="True">     349:</span> <span class="k">/* Strings allocated through PyUnicode_FromUnicode(NULL, len) use the</span>
<a name="350" /><span class="True">     350:</span> <span class="k">   PyUnicodeObject structure. The actual string data is initially in the wstr</span>
<a name="351" /><span class="True">     351:</span> <span class="k">   block, and copied into the data block using _PyUnicode_Ready. */</span>
<a name="352" /><span class="True">     352:</span> <span class="m">typedef</span> <span class="m">struct</span> <span class="f">{</span>
<a name="353" /><span class="True">     353:</span>     <span class="b">PyCompactUnicodeObject</span> <span class="b">_base</span><span class="f">;</span>
<a name="354" /><span class="True">     354:</span>     <span class="m">union</span> <span class="f">{</span>
<a name="355" /><span class="True">     355:</span>         <span class="m">void</span> <span class="f">*</span><span class="b">any</span><span class="f">;</span>
<a name="356" /><span class="True">     356:</span>         <span class="b">Py_UCS1</span> <span class="f">*</span><span class="b">latin1</span><span class="f">;</span>
<a name="357" /><span class="True">     357:</span>         <span class="b">Py_UCS2</span> <span class="f">*</span><span class="b">ucs2</span><span class="f">;</span>
<a name="358" /><span class="True">     358:</span>         <span class="b">Py_UCS4</span> <span class="f">*</span><span class="b">ucs4</span><span class="f">;</span>
<a name="359" /><span class="True">     359:</span>     <span class="f">}</span> <span class="b">data</span><span class="f">;</span>                     <span class="k">/* Canonical, smallest-form Unicode buffer */</span>
<a name="360" /><span class="True">     360:</span> <span class="f">}</span> <span class="b">PyUnicodeObject</span><span class="f">;</span>
<a name="361" /><span class="True">     361:</span> <span class="f">#</span><span class="n">endif</span>
<a name="362" /><span class="True">     362:</span> 
<a name="363" /><span class="True">     363:</span> <a href="macros_ref.html#_UHlBUElfREFUQV8w"><span class="b">PyAPI_DATA</span></a><span class="f">(</span><span class="b">PyTypeObject</span><span class="f">)</span> <span class="b">PyUnicode_Type</span><span class="f">;</span>
<a name="364" /><span class="True">     364:</span> <a href="macros_ref.html#_UHlBUElfREFUQV8w"><span class="b">PyAPI_DATA</span></a><span class="f">(</span><span class="b">PyTypeObject</span><span class="f">)</span> <span class="b">PyUnicodeIter_Type</span><span class="f">;</span>
<a name="365" /><span class="True">     365:</span> 
<a name="366" /><span class="True">     366:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_ref.html#_UHlVbmljb2RlX0NoZWNrXzA_"><span class="b">PyUnicode_Check</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> \
<a name="367" /><span class="True">     367:</span>                  <a href="macros_ref.html#_UHlUeXBlX0Zhc3RTdWJjbGFzc18w"><span class="b">PyType_FastSubclass</span></a><span class="f">(</span><a href="macros_ref.html#_UHlfVFlQRV8w"><span class="b">Py_TYPE</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">,</span> <a href="macros_ref.html#_UHlfVFBGTEFHU19VTklDT0RFX1NVQkNMQVNTXzA_"><span class="b">Py_TPFLAGS_UNICODE_SUBCLASS</span></a><span class="f">)</span>
<a name="368" /><span class="True">     368:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_ref.html#_UHlVbmljb2RlX0NoZWNrRXhhY3RfMA__"><span class="b">PyUnicode_CheckExact</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">(</span><a href="macros_ref.html#_UHlfVFlQRV8w"><span class="b">Py_TYPE</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">==</span> <span class="f">&amp;</span><span class="b">PyUnicode_Type</span><span class="f">)</span>
<a name="369" /><span class="True">     369:</span> 
<a name="370" /><span class="True">     370:</span> <span class="k">/* Fast access macros */</span>
<a name="371" /><span class="True">     371:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="372" /><span class="True">     372:</span> 
<a name="373" /><span class="True">     373:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlVbmljb2RlX1dTVFJfTEVOR1RIXzA_"><span class="b">PyUnicode_WSTR_LENGTH</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> \
<a name="374" /><span class="True">     374:</span>     <span class="f">(</span><a href="macros_noref.html#_UHlVbmljb2RlX0lTX0NPTVBBQ1RfQVNDSUlfMA__"><span class="b">PyUnicode_IS_COMPACT_ASCII</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">?</span>                  \
<a name="375" /><span class="True">     375:</span>      <span class="f">(</span><span class="f">(</span><span class="b">PyASCIIObject</span><span class="f">*</span><span class="f">)</span><span class="b">op</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">length</span> <span class="f">:</span>                    \
<a name="376" /><span class="True">     376:</span>      <span class="f">(</span><span class="f">(</span><span class="b">PyCompactUnicodeObject</span><span class="f">*</span><span class="f">)</span><span class="b">op</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr_length</span><span class="f">)</span>
<a name="377" /><span class="True">     377:</span> 
<a name="378" /><span class="True">     378:</span> <span class="k">/* Returns the deprecated Py_UNICODE representation&apos;s size in code units</span>
<a name="379" /><span class="True">     379:</span> <span class="k">   (this includes surrogate pairs as 2 units).</span>
<a name="380" /><span class="True">     380:</span> <span class="k">   If the Py_UNICODE representation is not available, it will be computed</span>
<a name="381" /><span class="True">     381:</span> <span class="k">   on request.  Use PyUnicode_GET_LENGTH() for the length in code points. */</span>
<a name="382" /><span class="True">     382:</span> 
<a name="383" /><span class="True">     383:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlVbmljb2RlX0dFVF9TSVpFXzA_"><span class="b">PyUnicode_GET_SIZE</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span>                       \
<a name="384" /><span class="True">     384:</span>     <span class="f">(</span><a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0NoZWNrXzA_"><span class="b">PyUnicode_Check</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">,</span>                    \
<a name="385" /><span class="True">     385:</span>      <span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">PyASCIIObject</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr</span><span class="f">)</span> <span class="f">?</span>               \
<a name="386" /><span class="True">     386:</span>       <a href="macros_noref.html#_UHlVbmljb2RlX1dTVFJfTEVOR1RIXzA_"><span class="b">PyUnicode_WSTR_LENGTH</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">:</span>                    \
<a name="387" /><span class="True">     387:</span>       <span class="f">(</span><span class="f">(</span><span class="m">void</span><span class="f">)</span><span class="b">PyUnicode_AsUnicode</span><span class="f">(</span><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">,</span>  \
<a name="388" /><span class="True">     388:</span>        <a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">PyASCIIObject</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr</span><span class="f">)</span><span class="f">,</span>        \
<a name="389" /><span class="True">     389:</span>        <a href="macros_noref.html#_UHlVbmljb2RlX1dTVFJfTEVOR1RIXzA_"><span class="b">PyUnicode_WSTR_LENGTH</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">)</span>
<a name="390" /><span class="True">     390:</span> 
<a name="391" /><span class="True">     391:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlVbmljb2RlX0dFVF9EQVRBX1NJWkVfMA__"><span class="b">PyUnicode_GET_DATA_SIZE</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> \
<a name="392" /><span class="True">     392:</span>     <span class="f">(</span><a href="macros_noref.html#_UHlVbmljb2RlX0dFVF9TSVpFXzA_"><span class="b">PyUnicode_GET_SIZE</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">*</span> <a href="macros_ref.html#_UHlfVU5JQ09ERV9TSVpFXzA_"><span class="b">Py_UNICODE_SIZE</span></a><span class="f">)</span>
<a name="393" /><span class="True">     393:</span> 
<a name="394" /><span class="True">     394:</span> <span class="k">/* Alias for PyUnicode_AsUnicode().  This will create a wchar_t/Py_UNICODE</span>
<a name="395" /><span class="True">     395:</span> <span class="k">   representation on demand.  Using this macro is very inefficient now,</span>
<a name="396" /><span class="True">     396:</span> <span class="k">   try to port your code to use the new PyUnicode_*BYTE_DATA() macros or</span>
<a name="397" /><span class="True">     397:</span> <span class="k">   use PyUnicode_WRITE() and PyUnicode_READ(). */</span>
<a name="398" /><span class="True">     398:</span> 
<a name="399" /><span class="True">     399:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlVbmljb2RlX0FTX1VOSUNPREVfMA__"><span class="b">PyUnicode_AS_UNICODE</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> \
<a name="400" /><span class="True">     400:</span>     <span class="f">(</span><a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0NoZWNrXzA_"><span class="b">PyUnicode_Check</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">,</span> \
<a name="401" /><span class="True">     401:</span>      <span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">PyASCIIObject</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr</span><span class="f">)</span> <span class="f">?</span> <span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">PyASCIIObject</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">wstr</span><span class="f">)</span> <span class="f">:</span> \
<a name="402" /><span class="True">     402:</span>       <span class="b">PyUnicode_AsUnicode</span><span class="f">(</span><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">)</span>
<a name="403" /><span class="True">     403:</span> 
<a name="404" /><span class="True">     404:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlVbmljb2RlX0FTX0RBVEFfMA__"><span class="b">PyUnicode_AS_DATA</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> \
<a name="405" /><span class="True">     405:</span>     <span class="f">(</span><span class="f">(</span><span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><a href="macros_noref.html#_UHlVbmljb2RlX0FTX1VOSUNPREVfMA__"><span class="b">PyUnicode_AS_UNICODE</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">)</span>
<a name="406" /><span class="True">     406:</span> 
<a name="407" /><span class="True">     407:</span> 
<a name="408" /><span class="True">     408:</span> <span class="k">/* --- Flexible String Representation Helper Macros (PEP 393) -------------- */</span>
<a name="409" /><span class="True">     409:</span> 
<a name="410" /><span class="True">     410:</span> <span class="k">/* Values for PyASCIIObject.state: */</span>
<a name="411" /><span class="True">     411:</span> 
<a name="412" /><span class="True">     412:</span> <span class="k">/* Interning state. */</span>
<a name="413" /><span class="True">     413:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_U1NUQVRFX05PVF9JTlRFUk5FRF8w"><span class="b">SSTATE_NOT_INTERNED</span></a> <span class="c">0</span>
<a name="414" /><span class="True">     414:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_U1NUQVRFX0lOVEVSTkVEX01PUlRBTF8w"><span class="b">SSTATE_INTERNED_MORTAL</span></a> <span class="c">1</span>
<a name="415" /><span class="True">     415:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_U1NUQVRFX0lOVEVSTkVEX0lNTU9SVEFMXzA_"><span class="b">SSTATE_INTERNED_IMMORTAL</span></a> <span class="c">2</span>
<a name="416" /><span class="True">     416:</span> 
<a name="417" /><span class="True">     417:</span> <span class="k">/* Return true if the string contains only ASCII characters, or 0 if not. The</span>
<a name="418" /><span class="True">     418:</span> <span class="k">   string may be compact (PyUnicode_IS_COMPACT_ASCII) or not, but must be</span>
<a name="419" /><span class="True">     419:</span> <span class="k">   ready. */</span>
<a name="420" /><span class="True">     420:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_ref.html#_UHlVbmljb2RlX0lTX0FTQ0lJXzA_"><span class="b">PyUnicode_IS_ASCII</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span>                   \
<a name="421" /><span class="True">     421:</span>     <span class="f">(</span><a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0NoZWNrXzA_"><span class="b">PyUnicode_Check</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">,</span>                \
<a name="422" /><span class="True">     422:</span>      <a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0lTX1JFQURZXzA_"><span class="b">PyUnicode_IS_READY</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">,</span>             \
<a name="423" /><span class="True">     423:</span>      <span class="f">(</span><span class="f">(</span><span class="b">PyASCIIObject</span><span class="f">*</span><span class="f">)</span><span class="b">op</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">state</span><span class="f">.</span><span class="b">ascii</span><span class="f">)</span>
<a name="424" /><span class="True">     424:</span> 
<a name="425" /><span class="True">     425:</span> <span class="k">/* Return true if the string is compact or 0 if not.</span>
<a name="426" /><span class="True">     426:</span> <span class="k">   No type checks or Ready calls are performed. */</span>
<a name="427" /><span class="True">     427:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_ref.html#_UHlVbmljb2RlX0lTX0NPTVBBQ1RfMA__"><span class="b">PyUnicode_IS_COMPACT</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> \
<a name="428" /><span class="True">     428:</span>     <span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">PyASCIIObject</span><span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">state</span><span class="f">.</span><span class="b">compact</span><span class="f">)</span>
<a name="429" /><span class="True">     429:</span> 
<a name="430" /><span class="True">     430:</span> <span class="k">/* Return true if the string is a compact ASCII string (use PyASCIIObject</span>
<a name="431" /><span class="True">     431:</span> <span class="k">   structure), or 0 if not.  No type checks or Ready calls are performed. */</span>
<a name="432" /><span class="True">     432:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlVbmljb2RlX0lTX0NPTVBBQ1RfQVNDSUlfMA__"><span class="b">PyUnicode_IS_COMPACT_ASCII</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span>                 \
<a name="433" /><span class="True">     433:</span>     <span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">PyASCIIObject</span><span class="f">*</span><span class="f">)</span><span class="b">op</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">state</span><span class="f">.</span><span class="b">ascii</span> <span class="f">&amp;&amp;</span> <a href="macros_ref.html#_UHlVbmljb2RlX0lTX0NPTVBBQ1RfMA__"><span class="b">PyUnicode_IS_COMPACT</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span>
<a name="434" /><span class="True">     434:</span> 
<a name="435" /><span class="True">     435:</span> <span class="m">enum</span> <span class="b">PyUnicode_Kind</span> <span class="f">{</span>
<a name="436" /><span class="True">     436:</span> <span class="k">/* String contains only wstr byte characters.  This is only possible</span>
<a name="437" /><span class="True">     437:</span> <span class="k">   when the string was created with a legacy API and _PyUnicode_Ready()</span>
<a name="438" /><span class="True">     438:</span> <span class="k">   has not been called yet.  */</span>
<a name="439" /><span class="True">     439:</span>     <span class="b">PyUnicode_WCHAR_KIND</span> <span class="f">=</span> <span class="c">0</span><span class="f">,</span>
<a name="440" /><span class="True">     440:</span> <span class="k">/* Return values of the PyUnicode_KIND() macro: */</span>
<a name="441" /><span class="True">     441:</span>     <span class="b">PyUnicode_1BYTE_KIND</span> <span class="f">=</span> <span class="c">1</span><span class="f">,</span>
<a name="442" /><span class="True">     442:</span>     <span class="b">PyUnicode_2BYTE_KIND</span> <span class="f">=</span> <span class="c">2</span><span class="f">,</span>
<a name="443" /><span class="True">     443:</span>     <span class="b">PyUnicode_4BYTE_KIND</span> <span class="f">=</span> <span class="c">4</span>
<a name="444" /><span class="True">     444:</span> <span class="f">}</span><span class="f">;</span>
<a name="445" /><span class="True">     445:</span> 
<a name="446" /><span class="True">     446:</span> <span class="k">/* Return pointers to the canonical representation cast to unsigned char,</span>
<a name="447" /><span class="True">     447:</span> <span class="k">   Py_UCS2, or Py_UCS4 for direct character access.</span>
<a name="448" /><span class="True">     448:</span> <span class="k">   No checks are performed, use PyUnicode_KIND() before to ensure</span>
<a name="449" /><span class="True">     449:</span> <span class="k">   these will work correctly. */</span>
<a name="450" /><span class="True">     450:</span> 
<a name="451" /><span class="True">     451:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_ref.html#_UHlVbmljb2RlXzFCWVRFX0RBVEFfMA__"><span class="b">PyUnicode_1BYTE_DATA</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">(</span><span class="f">(</span><span class="b">Py_UCS1</span><span class="f">*</span><span class="f">)</span><a href="macros_ref.html#_UHlVbmljb2RlX0RBVEFfMA__"><span class="b">PyUnicode_DATA</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span>
<a name="452" /><span class="True">     452:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlVbmljb2RlXzJCWVRFX0RBVEFfMA__"><span class="b">PyUnicode_2BYTE_DATA</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">(</span><span class="f">(</span><span class="b">Py_UCS2</span><span class="f">*</span><span class="f">)</span><a href="macros_ref.html#_UHlVbmljb2RlX0RBVEFfMA__"><span class="b">PyUnicode_DATA</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span>
<a name="453" /><span class="True">     453:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlVbmljb2RlXzRCWVRFX0RBVEFfMA__"><span class="b">PyUnicode_4BYTE_DATA</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">(</span><span class="f">(</span><span class="b">Py_UCS4</span><span class="f">*</span><span class="f">)</span><a href="macros_ref.html#_UHlVbmljb2RlX0RBVEFfMA__"><span class="b">PyUnicode_DATA</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span>
<a name="454" /><span class="True">     454:</span> 
<a name="455" /><span class="True">     455:</span> <span class="k">/* Return one of the PyUnicode_*_KIND values defined above. */</span>
<a name="456" /><span class="True">     456:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_ref.html#_UHlVbmljb2RlX0tJTkRfMA__"><span class="b">PyUnicode_KIND</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> \
<a name="457" /><span class="True">     457:</span>     <span class="f">(</span><a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0NoZWNrXzA_"><span class="b">PyUnicode_Check</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">,</span> \
<a name="458" /><span class="True">     458:</span>      <a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0lTX1JFQURZXzA_"><span class="b">PyUnicode_IS_READY</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">,</span>            \
<a name="459" /><span class="True">     459:</span>      <span class="f">(</span><span class="f">(</span><span class="b">PyASCIIObject</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">state</span><span class="f">.</span><span class="b">kind</span><span class="f">)</span>
<a name="460" /><span class="True">     460:</span> 
<a name="461" /><span class="True">     461:</span> <span class="k">/* Return a void pointer to the raw unicode buffer. */</span>
<a name="462" /><span class="True">     462:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_ref.html#_X1B5VW5pY29kZV9DT01QQUNUX0RBVEFfMA__"><span class="b">_PyUnicode_COMPACT_DATA</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span>                     \
<a name="463" /><span class="True">     463:</span>     <span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0lTX0FTQ0lJXzA_"><span class="b">PyUnicode_IS_ASCII</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">?</span>                   \
<a name="464" /><span class="True">     464:</span>      <span class="f">(</span><span class="f">(</span><span class="m">void</span><span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="f">(</span><span class="b">PyASCIIObject</span><span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">+</span> <span class="c">1</span><span class="f">)</span><span class="f">)</span> <span class="f">:</span>              \
<a name="465" /><span class="True">     465:</span>      <span class="f">(</span><span class="f">(</span><span class="m">void</span><span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="f">(</span><span class="b">PyCompactUnicodeObject</span><span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">+</span> <span class="c">1</span><span class="f">)</span><span class="f">)</span><span class="f">)</span>
<a name="466" /><span class="True">     466:</span> 
<a name="467" /><span class="True">     467:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_ref.html#_X1B5VW5pY29kZV9OT05DT01QQUNUX0RBVEFfMA__"><span class="b">_PyUnicode_NONCOMPACT_DATA</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span>                  \
<a name="468" /><span class="True">     468:</span>     <span class="f">(</span><a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">PyUnicodeObject</span><span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">data</span><span class="f">.</span><span class="b">any</span><span class="f">)</span><span class="f">,</span>        \
<a name="469" /><span class="True">     469:</span>      <span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">PyUnicodeObject</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">data</span><span class="f">.</span><span class="b">any</span><span class="f">)</span><span class="f">)</span><span class="f">)</span>
<a name="470" /><span class="True">     470:</span> 
<a name="471" /><span class="True">     471:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_ref.html#_UHlVbmljb2RlX0RBVEFfMA__"><span class="b">PyUnicode_DATA</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> \
<a name="472" /><span class="True">     472:</span>     <span class="f">(</span><a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0NoZWNrXzA_"><span class="b">PyUnicode_Check</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">,</span> \
<a name="473" /><span class="True">     473:</span>      <a href="macros_ref.html#_UHlVbmljb2RlX0lTX0NPTVBBQ1RfMA__"><span class="b">PyUnicode_IS_COMPACT</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">?</span> <a href="macros_ref.html#_X1B5VW5pY29kZV9DT01QQUNUX0RBVEFfMA__"><span class="b">_PyUnicode_COMPACT_DATA</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">:</span>   \
<a name="474" /><span class="True">     474:</span>      <a href="macros_ref.html#_X1B5VW5pY29kZV9OT05DT01QQUNUX0RBVEFfMA__"><span class="b">_PyUnicode_NONCOMPACT_DATA</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span>
<a name="475" /><span class="True">     475:</span> 
<a name="476" /><span class="True">     476:</span> <span class="k">/* In the access macros below, &quot;kind&quot; may be evaluated more than once.</span>
<a name="477" /><span class="True">     477:</span> <span class="k">   All other macro parameters are evaluated exactly once, so it is safe</span>
<a name="478" /><span class="True">     478:</span> <span class="k">   to put side effects into them (such as increasing the index). */</span>
<a name="479" /><span class="True">     479:</span> 
<a name="480" /><span class="True">     480:</span> <span class="k">/* Write into the canonical representation, this macro does not do any sanity</span>
<a name="481" /><span class="True">     481:</span> <span class="k">   checks and is intended for usage in loops.  The caller should cache the</span>
<a name="482" /><span class="True">     482:</span> <span class="k">   kind and data pointers obtained from other macro calls.</span>
<a name="483" /><span class="True">     483:</span> <span class="k">   index is the index in the string (starts at 0) and value is the new</span>
<a name="484" /><span class="True">     484:</span> <span class="k">   code point value which should be written to that location. */</span>
<a name="485" /><span class="True">     485:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlVbmljb2RlX1dSSVRFXzA_"><span class="b">PyUnicode_WRITE</span></a><span class="f">(</span><span class="b">kind</span><span class="f">,</span> <span class="b">data</span><span class="f">,</span> <span class="b">index</span><span class="f">,</span> <span class="b">value</span><span class="f">)</span> \
<a name="486" /><span class="True">     486:</span>     <span class="m">do</span> <span class="f">{</span> \
<a name="487" /><span class="True">     487:</span>         <span class="m">switch</span> <span class="f">(</span><span class="f">(</span><span class="b">kind</span><span class="f">)</span><span class="f">)</span> <span class="f">{</span> \
<a name="488" /><span class="True">     488:</span>         <span class="m">case</span> <span class="b">PyUnicode_1BYTE_KIND</span><span class="f">:</span> <span class="f">{</span> \
<a name="489" /><span class="True">     489:</span>             <span class="f">(</span><span class="f">(</span><span class="b">Py_UCS1</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">data</span><span class="f">)</span><span class="f">)</span><span class="f">[</span><span class="f">(</span><span class="b">index</span><span class="f">)</span><span class="f">]</span> <span class="f">=</span> <span class="f">(</span><span class="b">Py_UCS1</span><span class="f">)</span><span class="f">(</span><span class="b">value</span><span class="f">)</span><span class="f">;</span> \
<a name="490" /><span class="True">     490:</span>             <span class="m">break</span><span class="f">;</span> \
<a name="491" /><span class="True">     491:</span>         <span class="f">}</span> \
<a name="492" /><span class="True">     492:</span>         <span class="m">case</span> <span class="b">PyUnicode_2BYTE_KIND</span><span class="f">:</span> <span class="f">{</span> \
<a name="493" /><span class="True">     493:</span>             <span class="f">(</span><span class="f">(</span><span class="b">Py_UCS2</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">data</span><span class="f">)</span><span class="f">)</span><span class="f">[</span><span class="f">(</span><span class="b">index</span><span class="f">)</span><span class="f">]</span> <span class="f">=</span> <span class="f">(</span><span class="b">Py_UCS2</span><span class="f">)</span><span class="f">(</span><span class="b">value</span><span class="f">)</span><span class="f">;</span> \
<a name="494" /><span class="True">     494:</span>             <span class="m">break</span><span class="f">;</span> \
<a name="495" /><span class="True">     495:</span>         <span class="f">}</span> \
<a name="496" /><span class="True">     496:</span>         <span class="m">default</span><span class="f">:</span> <span class="f">{</span> \
<a name="497" /><span class="True">     497:</span>             <a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><span class="f">(</span><span class="b">kind</span><span class="f">)</span> <span class="f">==</span> <span class="b">PyUnicode_4BYTE_KIND</span><span class="f">)</span><span class="f">;</span> \
<a name="498" /><span class="True">     498:</span>             <span class="f">(</span><span class="f">(</span><span class="b">Py_UCS4</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">data</span><span class="f">)</span><span class="f">)</span><span class="f">[</span><span class="f">(</span><span class="b">index</span><span class="f">)</span><span class="f">]</span> <span class="f">=</span> <span class="f">(</span><span class="b">Py_UCS4</span><span class="f">)</span><span class="f">(</span><span class="b">value</span><span class="f">)</span><span class="f">;</span> \
<a name="499" /><span class="True">     499:</span>         <span class="f">}</span> \
<a name="500" /><span class="True">     500:</span>         <span class="f">}</span> \
<a name="501" /><span class="True">     501:</span>     <span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="502" /><span class="True">     502:</span> 
<a name="503" /><span class="True">     503:</span> <span class="k">/* Read a code point from the string&apos;s canonical representation.  No checks</span>
<a name="504" /><span class="True">     504:</span> <span class="k">   or ready calls are performed. */</span>
<a name="505" /><span class="True">     505:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlVbmljb2RlX1JFQURfMA__"><span class="b">PyUnicode_READ</span></a><span class="f">(</span><span class="b">kind</span><span class="f">,</span> <span class="b">data</span><span class="f">,</span> <span class="b">index</span><span class="f">)</span> \
<a name="506" /><span class="True">     506:</span>     <span class="f">(</span><span class="f">(</span><span class="b">Py_UCS4</span><span class="f">)</span> \
<a name="507" /><span class="True">     507:</span>     <span class="f">(</span><span class="f">(</span><span class="b">kind</span><span class="f">)</span> <span class="f">==</span> <span class="b">PyUnicode_1BYTE_KIND</span> <span class="f">?</span> \
<a name="508" /><span class="True">     508:</span>         <span class="f">(</span><span class="f">(</span><span class="m">const</span> <span class="b">Py_UCS1</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">data</span><span class="f">)</span><span class="f">)</span><span class="f">[</span><span class="f">(</span><span class="b">index</span><span class="f">)</span><span class="f">]</span> <span class="f">:</span> \
<a name="509" /><span class="True">     509:</span>         <span class="f">(</span><span class="f">(</span><span class="b">kind</span><span class="f">)</span> <span class="f">==</span> <span class="b">PyUnicode_2BYTE_KIND</span> <span class="f">?</span> \
<a name="510" /><span class="True">     510:</span>             <span class="f">(</span><span class="f">(</span><span class="m">const</span> <span class="b">Py_UCS2</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">data</span><span class="f">)</span><span class="f">)</span><span class="f">[</span><span class="f">(</span><span class="b">index</span><span class="f">)</span><span class="f">]</span> <span class="f">:</span> \
<a name="511" /><span class="True">     511:</span>             <span class="f">(</span><span class="f">(</span><span class="m">const</span> <span class="b">Py_UCS4</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">data</span><span class="f">)</span><span class="f">)</span><span class="f">[</span><span class="f">(</span><span class="b">index</span><span class="f">)</span><span class="f">]</span> \
<a name="512" /><span class="True">     512:</span>         <span class="f">)</span> \
<a name="513" /><span class="True">     513:</span>     <span class="f">)</span><span class="f">)</span>
<a name="514" /><span class="True">     514:</span> 
<a name="515" /><span class="True">     515:</span> <span class="k">/* PyUnicode_READ_CHAR() is less efficient than PyUnicode_READ() because it</span>
<a name="516" /><span class="True">     516:</span> <span class="k">   calls PyUnicode_KIND() and might call it twice.  For single reads, use</span>
<a name="517" /><span class="True">     517:</span> <span class="k">   PyUnicode_READ_CHAR, for multiple consecutive reads callers should</span>
<a name="518" /><span class="True">     518:</span> <span class="k">   cache kind and use PyUnicode_READ instead. */</span>
<a name="519" /><span class="True">     519:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlVbmljb2RlX1JFQURfQ0hBUl8w"><span class="b">PyUnicode_READ_CHAR</span></a><span class="f">(</span><span class="b">unicode</span><span class="f">,</span> <span class="b">index</span><span class="f">)</span> \
<a name="520" /><span class="True">     520:</span>     <span class="f">(</span><a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0NoZWNrXzA_"><span class="b">PyUnicode_Check</span></a><span class="f">(</span><span class="b">unicode</span><span class="f">)</span><span class="f">)</span><span class="f">,</span>          \
<a name="521" /><span class="True">     521:</span>      <a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0lTX1JFQURZXzA_"><span class="b">PyUnicode_IS_READY</span></a><span class="f">(</span><span class="b">unicode</span><span class="f">)</span><span class="f">)</span><span class="f">,</span>       \
<a name="522" /><span class="True">     522:</span>      <span class="f">(</span><span class="b">Py_UCS4</span><span class="f">)</span>                                  \
<a name="523" /><span class="True">     523:</span>         <span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0tJTkRfMA__"><span class="b">PyUnicode_KIND</span></a><span class="f">(</span><span class="f">(</span><span class="b">unicode</span><span class="f">)</span><span class="f">)</span> <span class="f">==</span> <span class="b">PyUnicode_1BYTE_KIND</span> <span class="f">?</span> \
<a name="524" /><span class="True">     524:</span>             <span class="f">(</span><span class="f">(</span><span class="m">const</span> <span class="b">Py_UCS1</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0RBVEFfMA__"><span class="b">PyUnicode_DATA</span></a><span class="f">(</span><span class="f">(</span><span class="b">unicode</span><span class="f">)</span><span class="f">)</span><span class="f">)</span><span class="f">)</span><span class="f">[</span><span class="f">(</span><span class="b">index</span><span class="f">)</span><span class="f">]</span> <span class="f">:</span> \
<a name="525" /><span class="True">     525:</span>             <span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0tJTkRfMA__"><span class="b">PyUnicode_KIND</span></a><span class="f">(</span><span class="f">(</span><span class="b">unicode</span><span class="f">)</span><span class="f">)</span> <span class="f">==</span> <span class="b">PyUnicode_2BYTE_KIND</span> <span class="f">?</span> \
<a name="526" /><span class="True">     526:</span>                 <span class="f">(</span><span class="f">(</span><span class="m">const</span> <span class="b">Py_UCS2</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0RBVEFfMA__"><span class="b">PyUnicode_DATA</span></a><span class="f">(</span><span class="f">(</span><span class="b">unicode</span><span class="f">)</span><span class="f">)</span><span class="f">)</span><span class="f">)</span><span class="f">[</span><span class="f">(</span><span class="b">index</span><span class="f">)</span><span class="f">]</span> <span class="f">:</span> \
<a name="527" /><span class="True">     527:</span>                 <span class="f">(</span><span class="f">(</span><span class="m">const</span> <span class="b">Py_UCS4</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0RBVEFfMA__"><span class="b">PyUnicode_DATA</span></a><span class="f">(</span><span class="f">(</span><span class="b">unicode</span><span class="f">)</span><span class="f">)</span><span class="f">)</span><span class="f">)</span><span class="f">[</span><span class="f">(</span><span class="b">index</span><span class="f">)</span><span class="f">]</span> \
<a name="528" /><span class="True">     528:</span>             <span class="f">)</span> \
<a name="529" /><span class="True">     529:</span>         <span class="f">)</span><span class="f">)</span>
<a name="530" /><span class="True">     530:</span> 
<a name="531" /><span class="True">     531:</span> <span class="k">/* Returns the length of the unicode string. The caller has to make sure that</span>
<a name="532" /><span class="True">     532:</span> <span class="k">   the string has it&apos;s canonical representation set before calling</span>
<a name="533" /><span class="True">     533:</span> <span class="k">   this macro.  Call PyUnicode_(FAST_)Ready to ensure that. */</span>
<a name="534" /><span class="True">     534:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_ref.html#_UHlVbmljb2RlX0dFVF9MRU5HVEhfMA__"><span class="b">PyUnicode_GET_LENGTH</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span>                \
<a name="535" /><span class="True">     535:</span>     <span class="f">(</span><a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0NoZWNrXzA_"><span class="b">PyUnicode_Check</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">,</span>               \
<a name="536" /><span class="True">     536:</span>      <a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0lTX1JFQURZXzA_"><span class="b">PyUnicode_IS_READY</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">,</span>            \
<a name="537" /><span class="True">     537:</span>      <span class="f">(</span><span class="f">(</span><span class="b">PyASCIIObject</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">length</span><span class="f">)</span>
<a name="538" /><span class="True">     538:</span> 
<a name="539" /><span class="True">     539:</span> 
<a name="540" /><span class="True">     540:</span> <span class="k">/* Fast check to determine whether an object is ready. Equivalent to</span>
<a name="541" /><span class="True">     541:</span> <span class="k">   PyUnicode_IS_COMPACT(op) || ((PyUnicodeObject*)(op))-&gt;data.any) */</span>
<a name="542" /><span class="True">     542:</span> 
<a name="543" /><span class="True">     543:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_ref.html#_UHlVbmljb2RlX0lTX1JFQURZXzA_"><span class="b">PyUnicode_IS_READY</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">PyASCIIObject</span><span class="f">*</span><span class="f">)</span><span class="b">op</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">state</span><span class="f">.</span><span class="b">ready</span><span class="f">)</span>
<a name="544" /><span class="True">     544:</span> 
<a name="545" /><span class="True">     545:</span> <span class="k">/* PyUnicode_READY() does less work than _PyUnicode_Ready() in the best</span>
<a name="546" /><span class="True">     546:</span> <span class="k">   case.  If the canonical representation is not yet set, it will still call</span>
<a name="547" /><span class="True">     547:</span> <span class="k">   _PyUnicode_Ready().</span>
<a name="548" /><span class="True">     548:</span> <span class="k">   Returns 0 on success and -1 on errors. */</span>
<a name="549" /><span class="True">     549:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_ref.html#_UHlVbmljb2RlX1JFQURZXzA_"><span class="b">PyUnicode_READY</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span>                        \
<a name="550" /><span class="True">     550:</span>     <span class="f">(</span><a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0NoZWNrXzA_"><span class="b">PyUnicode_Check</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">,</span>                       \
<a name="551" /><span class="True">     551:</span>      <span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0lTX1JFQURZXzA_"><span class="b">PyUnicode_IS_READY</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">?</span>                          \
<a name="552" /><span class="True">     552:</span>       <span class="c">0</span> <span class="f">:</span> <span class="b">_PyUnicode_Ready</span><span class="f">(</span><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">)</span><span class="f">)</span>
<a name="553" /><span class="True">     553:</span> 
<a name="554" /><span class="True">     554:</span> <span class="k">/* Return a maximum character value which is suitable for creating another</span>
<a name="555" /><span class="True">     555:</span> <span class="k">   string based on op.  This is always an approximation but more efficient</span>
<a name="556" /><span class="True">     556:</span> <span class="k">   than iterating over the string. */</span>
<a name="557" /><span class="True">     557:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlVbmljb2RlX01BWF9DSEFSX1ZBTFVFXzA_"><span class="b">PyUnicode_MAX_CHAR_VALUE</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> \
<a name="558" /><span class="True">     558:</span>     <span class="f">(</span><a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0lTX1JFQURZXzA_"><span class="b">PyUnicode_IS_READY</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">,</span>                                    \
<a name="559" /><span class="True">     559:</span>      <span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0lTX0FTQ0lJXzA_"><span class="b">PyUnicode_IS_ASCII</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">?</span>                                          \
<a name="560" /><span class="True">     560:</span>       <span class="f">(</span><span class="c">0x7f</span><span class="f">)</span> <span class="f">:</span>                                                          \
<a name="561" /><span class="True">     561:</span>       <span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0tJTkRfMA__"><span class="b">PyUnicode_KIND</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">==</span> <span class="b">PyUnicode_1BYTE_KIND</span> <span class="f">?</span>                     \
<a name="562" /><span class="True">     562:</span>        <span class="f">(</span><span class="c">0xffU</span><span class="f">)</span> <span class="f">:</span>                                                        \
<a name="563" /><span class="True">     563:</span>        <span class="f">(</span><a href="macros_ref.html#_UHlVbmljb2RlX0tJTkRfMA__"><span class="b">PyUnicode_KIND</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">==</span> <span class="b">PyUnicode_2BYTE_KIND</span> <span class="f">?</span>                    \
<a name="564" /><span class="True">     564:</span>         <span class="f">(</span><span class="c">0xffffU</span><span class="f">)</span> <span class="f">:</span>                                                     \
<a name="565" /><span class="True">     565:</span>         <span class="f">(</span><span class="c">0x10ffffU</span><span class="f">)</span><span class="f">)</span><span class="f">)</span><span class="f">)</span><span class="f">)</span>
<a name="566" /><span class="True">     566:</span> 
<a name="567" /><span class="True">     567:</span> <span class="f">#</span><span class="n">endif</span>
<a name="568" /><span class="True">     568:</span> 
<a name="569" /><span class="True">     569:</span> <span class="k">/* --- Constants ---------------------------------------------------------- */</span>
<a name="570" /><span class="True">     570:</span> 
<a name="571" /><span class="True">     571:</span> <span class="k">/* This Unicode character will be used as replacement character during</span>
<a name="572" /><span class="True">     572:</span> <span class="k">   decoding if the errors argument is set to &quot;replace&quot;. Note: the</span>
<a name="573" /><span class="True">     573:</span> <span class="k">   Unicode character U+FFFD is the official REPLACEMENT CHARACTER in</span>
<a name="574" /><span class="True">     574:</span> <span class="k">   Unicode 3.0. */</span>
<a name="575" /><span class="True">     575:</span> 
<a name="576" /><span class="True">     576:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfVU5JQ09ERV9SRVBMQUNFTUVOVF9DSEFSQUNURVJfMA__"><span class="b">Py_UNICODE_REPLACEMENT_CHARACTER</span></a> <span class="f">(</span><span class="f">(</span><span class="b">Py_UCS4</span><span class="f">)</span> <span class="c">0xFFFD</span><span class="f">)</span>
<a name="577" /><span class="True">     577:</span> 
<a name="578" /><span class="True">     578:</span> <span class="k">/* === Public API ========================================================= */</span>
<a name="579" /><span class="True">     579:</span> 
<a name="580" /><span class="True">     580:</span> <span class="k">/* --- Plain Py_UNICODE --------------------------------------------------- */</span>
<a name="581" /><span class="True">     581:</span> 
<a name="582" /><span class="True">     582:</span> <span class="k">/* With PEP 393, this is the recommended way to allocate a new unicode object.</span>
<a name="583" /><span class="True">     583:</span> <span class="k">   This function will allocate the object and its buffer in a single memory</span>
<a name="584" /><span class="True">     584:</span> <span class="k">   block.  Objects created using this function are not resizable. */</span>
<a name="585" /><span class="True">     585:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="586" /><span class="True">     586:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_New</span><span class="f">(</span>
<a name="587" /><span class="True">     587:</span>     <span class="b">Py_ssize_t</span> <span class="b">size</span><span class="f">,</span>            <span class="k">/* Number of code points in the new string */</span>
<a name="588" /><span class="True">     588:</span>     <span class="b">Py_UCS4</span> <span class="b">maxchar</span>             <span class="k">/* maximum code point value in the string */</span>
<a name="589" /><span class="True">     589:</span>     <span class="f">)</span><span class="f">;</span>
<a name="590" /><span class="True">     590:</span> <span class="f">#</span><span class="n">endif</span>
<a name="591" /><span class="True">     591:</span> 
<a name="592" /><span class="True">     592:</span> <span class="k">/* Initializes the canonical string representation from the deprecated</span>
<a name="593" /><span class="True">     593:</span> <span class="k">   wstr/Py_UNICODE representation. This function is used to convert Unicode</span>
<a name="594" /><span class="True">     594:</span> <span class="k">   objects which were created using the old API to the new flexible format</span>
<a name="595" /><span class="True">     595:</span> <span class="k">   introduced with PEP 393.</span>
<a name="596" /><span class="True">     596:</span> <span class="k"></span>
<a name="597" /><span class="True">     597:</span> <span class="k">   Don&apos;t call this function directly, use the public PyUnicode_READY() macro</span>
<a name="598" /><span class="True">     598:</span> <span class="k">   instead. */</span>
<a name="599" /><span class="True">     599:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="600" /><span class="True">     600:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_Ready</span><span class="f">(</span>
<a name="601" /><span class="True">     601:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>           <span class="k">/* Unicode object */</span>
<a name="602" /><span class="True">     602:</span>     <span class="f">)</span><span class="f">;</span>
<a name="603" /><span class="True">     603:</span> <span class="f">#</span><span class="n">endif</span>
<a name="604" /><span class="True">     604:</span> 
<a name="605" /><span class="True">     605:</span> <span class="k">/* Get a copy of a Unicode string. */</span>
<a name="606" /><span class="True">     606:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="607" /><span class="True">     607:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_Copy</span><span class="f">(</span>
<a name="608" /><span class="True">     608:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>
<a name="609" /><span class="True">     609:</span>     <span class="f">)</span><span class="f">;</span>
<a name="610" /><span class="True">     610:</span> <span class="f">#</span><span class="n">endif</span>
<a name="611" /><span class="True">     611:</span> 
<a name="612" /><span class="True">     612:</span> <span class="k">/* Copy character from one unicode object into another, this function performs</span>
<a name="613" /><span class="True">     613:</span> <span class="k">   character conversion when necessary and falls back to memcpy() if possible.</span>
<a name="614" /><span class="True">     614:</span> <span class="k"></span>
<a name="615" /><span class="True">     615:</span> <span class="k">   Fail if to is too small (smaller than *how_many* or smaller than</span>
<a name="616" /><span class="True">     616:</span> <span class="k">   len(from)-from_start), or if kind(from[from_start:from_start+how_many]) &gt;</span>
<a name="617" /><span class="True">     617:</span> <span class="k">   kind(to), or if *to* has more than 1 reference.</span>
<a name="618" /><span class="True">     618:</span> <span class="k"></span>
<a name="619" /><span class="True">     619:</span> <span class="k">   Return the number of written character, or return -1 and raise an exception</span>
<a name="620" /><span class="True">     620:</span> <span class="k">   on error.</span>
<a name="621" /><span class="True">     621:</span> <span class="k"></span>
<a name="622" /><span class="True">     622:</span> <span class="k">   Pseudo-code:</span>
<a name="623" /><span class="True">     623:</span> <span class="k"></span>
<a name="624" /><span class="True">     624:</span> <span class="k">       how_many = min(how_many, len(from) - from_start)</span>
<a name="625" /><span class="True">     625:</span> <span class="k">       to[to_start:to_start+how_many] = from[from_start:from_start+how_many]</span>
<a name="626" /><span class="True">     626:</span> <span class="k">       return how_many</span>
<a name="627" /><span class="True">     627:</span> <span class="k"></span>
<a name="628" /><span class="True">     628:</span> <span class="k">   Note: The function doesn&apos;t write a terminating null character.</span>
<a name="629" /><span class="True">     629:</span> <span class="k">   */</span>
<a name="630" /><span class="True">     630:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="631" /><span class="True">     631:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_ssize_t</span><span class="f">)</span> <span class="b">PyUnicode_CopyCharacters</span><span class="f">(</span>
<a name="632" /><span class="True">     632:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">to</span><span class="f">,</span>
<a name="633" /><span class="True">     633:</span>     <span class="b">Py_ssize_t</span> <span class="b">to_start</span><span class="f">,</span>
<a name="634" /><span class="True">     634:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">from</span><span class="f">,</span>
<a name="635" /><span class="True">     635:</span>     <span class="b">Py_ssize_t</span> <span class="b">from_start</span><span class="f">,</span>
<a name="636" /><span class="True">     636:</span>     <span class="b">Py_ssize_t</span> <span class="b">how_many</span>
<a name="637" /><span class="True">     637:</span>     <span class="f">)</span><span class="f">;</span>
<a name="638" /><span class="True">     638:</span> 
<a name="639" /><span class="True">     639:</span> <span class="k">/* Unsafe version of PyUnicode_CopyCharacters(): don&apos;t check arguments and so</span>
<a name="640" /><span class="True">     640:</span> <span class="k">   may crash if parameters are invalid (e.g. if the output string</span>
<a name="641" /><span class="True">     641:</span> <span class="k">   is too short). */</span>
<a name="642" /><span class="True">     642:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">void</span><span class="f">)</span> <span class="b">_PyUnicode_FastCopyCharacters</span><span class="f">(</span>
<a name="643" /><span class="True">     643:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">to</span><span class="f">,</span>
<a name="644" /><span class="True">     644:</span>     <span class="b">Py_ssize_t</span> <span class="b">to_start</span><span class="f">,</span>
<a name="645" /><span class="True">     645:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">from</span><span class="f">,</span>
<a name="646" /><span class="True">     646:</span>     <span class="b">Py_ssize_t</span> <span class="b">from_start</span><span class="f">,</span>
<a name="647" /><span class="True">     647:</span>     <span class="b">Py_ssize_t</span> <span class="b">how_many</span>
<a name="648" /><span class="True">     648:</span>     <span class="f">)</span><span class="f">;</span>
<a name="649" /><span class="True">     649:</span> <span class="f">#</span><span class="n">endif</span>
<a name="650" /><span class="True">     650:</span> 
<a name="651" /><span class="True">     651:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="652" /><span class="True">     652:</span> <span class="k">/* Fill a string with a character: write fill_char into</span>
<a name="653" /><span class="True">     653:</span> <span class="k">   unicode[start:start+length].</span>
<a name="654" /><span class="True">     654:</span> <span class="k"></span>
<a name="655" /><span class="True">     655:</span> <span class="k">   Fail if fill_char is bigger than the string maximum character, or if the</span>
<a name="656" /><span class="True">     656:</span> <span class="k">   string has more than 1 reference.</span>
<a name="657" /><span class="True">     657:</span> <span class="k"></span>
<a name="658" /><span class="True">     658:</span> <span class="k">   Return the number of written character, or return -1 and raise an exception</span>
<a name="659" /><span class="True">     659:</span> <span class="k">   on error. */</span>
<a name="660" /><span class="True">     660:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_ssize_t</span><span class="f">)</span> <span class="b">PyUnicode_Fill</span><span class="f">(</span>
<a name="661" /><span class="True">     661:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>
<a name="662" /><span class="True">     662:</span>     <span class="b">Py_ssize_t</span> <span class="b">start</span><span class="f">,</span>
<a name="663" /><span class="True">     663:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>
<a name="664" /><span class="True">     664:</span>     <span class="b">Py_UCS4</span> <span class="b">fill_char</span>
<a name="665" /><span class="True">     665:</span>     <span class="f">)</span><span class="f">;</span>
<a name="666" /><span class="True">     666:</span> 
<a name="667" /><span class="True">     667:</span> <span class="k">/* Unsafe version of PyUnicode_Fill(): don&apos;t check arguments and so may crash</span>
<a name="668" /><span class="True">     668:</span> <span class="k">   if parameters are invalid (e.g. if length is longer than the string). */</span>
<a name="669" /><span class="True">     669:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">void</span><span class="f">)</span> <span class="b">_PyUnicode_FastFill</span><span class="f">(</span>
<a name="670" /><span class="True">     670:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>
<a name="671" /><span class="True">     671:</span>     <span class="b">Py_ssize_t</span> <span class="b">start</span><span class="f">,</span>
<a name="672" /><span class="True">     672:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>
<a name="673" /><span class="True">     673:</span>     <span class="b">Py_UCS4</span> <span class="b">fill_char</span>
<a name="674" /><span class="True">     674:</span>     <span class="f">)</span><span class="f">;</span>
<a name="675" /><span class="True">     675:</span> <span class="f">#</span><span class="n">endif</span>
<a name="676" /><span class="True">     676:</span> 
<a name="677" /><span class="True">     677:</span> <span class="k">/* Create a Unicode Object from the Py_UNICODE buffer u of the given</span>
<a name="678" /><span class="True">     678:</span> <span class="k">   size.</span>
<a name="679" /><span class="True">     679:</span> <span class="k"></span>
<a name="680" /><span class="True">     680:</span> <span class="k">   u may be NULL which causes the contents to be undefined. It is the</span>
<a name="681" /><span class="True">     681:</span> <span class="k">   user&apos;s responsibility to fill in the needed data afterwards. Note</span>
<a name="682" /><span class="True">     682:</span> <span class="k">   that modifying the Unicode object contents after construction is</span>
<a name="683" /><span class="True">     683:</span> <span class="k">   only allowed if u was set to NULL.</span>
<a name="684" /><span class="True">     684:</span> <span class="k"></span>
<a name="685" /><span class="True">     685:</span> <span class="k">   The buffer is copied into the new object. */</span>
<a name="686" /><span class="True">     686:</span> 
<a name="687" /><span class="True">     687:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="688" /><span class="True">     688:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_FromUnicode</span><span class="f">(</span>
<a name="689" /><span class="True">     689:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">u</span><span class="f">,</span>        <span class="k">/* Unicode buffer */</span>
<a name="690" /><span class="True">     690:</span>     <span class="b">Py_ssize_t</span> <span class="b">size</span>             <span class="k">/* size of buffer */</span>
<a name="691" /><span class="True">     691:</span>     <span class="f">)</span><span class="f">;</span>
<a name="692" /><span class="True">     692:</span> <span class="f">#</span><span class="n">endif</span>
<a name="693" /><span class="True">     693:</span> 
<a name="694" /><span class="True">     694:</span> <span class="k">/* Similar to PyUnicode_FromUnicode(), but u points to UTF-8 encoded bytes */</span>
<a name="695" /><span class="True">     695:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_FromStringAndSize</span><span class="f">(</span>
<a name="696" /><span class="True">     696:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">u</span><span class="f">,</span>             <span class="k">/* UTF-8 encoded string */</span>
<a name="697" /><span class="True">     697:</span>     <span class="b">Py_ssize_t</span> <span class="b">size</span>            <span class="k">/* size of buffer */</span>
<a name="698" /><span class="True">     698:</span>     <span class="f">)</span><span class="f">;</span>
<a name="699" /><span class="True">     699:</span> 
<a name="700" /><span class="True">     700:</span> <span class="k">/* Similar to PyUnicode_FromUnicode(), but u points to null-terminated</span>
<a name="701" /><span class="True">     701:</span> <span class="k">   UTF-8 encoded bytes.  The size is determined with strlen(). */</span>
<a name="702" /><span class="True">     702:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_FromString</span><span class="f">(</span>
<a name="703" /><span class="True">     703:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">u</span>              <span class="k">/* UTF-8 encoded string */</span>
<a name="704" /><span class="True">     704:</span>     <span class="f">)</span><span class="f">;</span>
<a name="705" /><span class="True">     705:</span> 
<a name="706" /><span class="True">     706:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="707" /><span class="True">     707:</span> <span class="k">/* Create a new string from a buffer of Py_UCS1, Py_UCS2 or Py_UCS4 characters.</span>
<a name="708" /><span class="True">     708:</span> <span class="k">   Scan the string to find the maximum character. */</span>
<a name="709" /><span class="True">     709:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_FromKindAndData</span><span class="f">(</span>
<a name="710" /><span class="True">     710:</span>     <span class="m">int</span> <span class="b">kind</span><span class="f">,</span>
<a name="711" /><span class="True">     711:</span>     <span class="m">const</span> <span class="m">void</span> <span class="f">*</span><span class="b">buffer</span><span class="f">,</span>
<a name="712" /><span class="True">     712:</span>     <span class="b">Py_ssize_t</span> <span class="b">size</span><span class="f">)</span><span class="f">;</span>
<a name="713" /><span class="True">     713:</span> 
<a name="714" /><span class="True">     714:</span> <span class="k">/* Create a new string from a buffer of ASCII characters.</span>
<a name="715" /><span class="True">     715:</span> <span class="k">   WARNING: Don&apos;t check if the string contains any non-ASCII character. */</span>
<a name="716" /><span class="True">     716:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_FromASCII</span><span class="f">(</span>
<a name="717" /><span class="True">     717:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">buffer</span><span class="f">,</span>
<a name="718" /><span class="True">     718:</span>     <span class="b">Py_ssize_t</span> <span class="b">size</span><span class="f">)</span><span class="f">;</span>
<a name="719" /><span class="True">     719:</span> <span class="f">#</span><span class="n">endif</span>
<a name="720" /><span class="True">     720:</span> 
<a name="721" /><span class="True">     721:</span> <span class="f">#</span><span class="n">if</span> <span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">Py_LIMITED_API</span><span class="f">)</span> <span class="f">||</span> <span class="b">Py_LIMITED_API</span><span class="f">+</span><span class="c">0</span> <span class="f">&gt;=</span> <span class="c">0x03030000</span>
<a name="722" /><span class="True">     722:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_Substring</span><span class="f">(</span>
<a name="723" /><span class="True">     723:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">str</span><span class="f">,</span>
<a name="724" /><span class="True">     724:</span>     <span class="b">Py_ssize_t</span> <span class="b">start</span><span class="f">,</span>
<a name="725" /><span class="True">     725:</span>     <span class="b">Py_ssize_t</span> <span class="b">end</span><span class="f">)</span><span class="f">;</span>
<a name="726" /><span class="True">     726:</span> <span class="f">#</span><span class="n">endif</span>
<a name="727" /><span class="True">     727:</span> 
<a name="728" /><span class="True">     728:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="729" /><span class="True">     729:</span> <span class="k">/* Compute the maximum character of the substring unicode[start:end].</span>
<a name="730" /><span class="True">     730:</span> <span class="k">   Return 127 for an empty string. */</span>
<a name="731" /><span class="True">     731:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UCS4</span><span class="f">)</span> <span class="b">_PyUnicode_FindMaxChar</span> <span class="f">(</span>
<a name="732" /><span class="True">     732:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>
<a name="733" /><span class="True">     733:</span>     <span class="b">Py_ssize_t</span> <span class="b">start</span><span class="f">,</span>
<a name="734" /><span class="True">     734:</span>     <span class="b">Py_ssize_t</span> <span class="b">end</span><span class="f">)</span><span class="f">;</span>
<a name="735" /><span class="True">     735:</span> <span class="f">#</span><span class="n">endif</span>
<a name="736" /><span class="True">     736:</span> 
<a name="737" /><span class="True">     737:</span> <span class="f">#</span><span class="n">if</span> <span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">Py_LIMITED_API</span><span class="f">)</span> <span class="f">||</span> <span class="b">Py_LIMITED_API</span><span class="f">+</span><span class="c">0</span> <span class="f">&gt;=</span> <span class="c">0x03030000</span>
<a name="738" /><span class="True">     738:</span> <span class="k">/* Copy the string into a UCS4 buffer including the null character if copy_null</span>
<a name="739" /><span class="True">     739:</span> <span class="k">   is set. Return NULL and raise an exception on error. Raise a SystemError if</span>
<a name="740" /><span class="True">     740:</span> <span class="k">   the buffer is smaller than the string. Return buffer on success.</span>
<a name="741" /><span class="True">     741:</span> <span class="k"></span>
<a name="742" /><span class="True">     742:</span> <span class="k">   buflen is the length of the buffer in (Py_UCS4) characters. */</span>
<a name="743" /><span class="True">     743:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UCS4</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsUCS4</span><span class="f">(</span>
<a name="744" /><span class="True">     744:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>
<a name="745" /><span class="True">     745:</span>     <span class="b">Py_UCS4</span><span class="f">*</span> <span class="b">buffer</span><span class="f">,</span>
<a name="746" /><span class="True">     746:</span>     <span class="b">Py_ssize_t</span> <span class="b">buflen</span><span class="f">,</span>
<a name="747" /><span class="True">     747:</span>     <span class="m">int</span> <span class="b">copy_null</span><span class="f">)</span><span class="f">;</span>
<a name="748" /><span class="True">     748:</span> 
<a name="749" /><span class="True">     749:</span> <span class="k">/* Copy the string into a UCS4 buffer. A new buffer is allocated using</span>
<a name="750" /><span class="True">     750:</span> <span class="k"> * PyMem_Malloc; if this fails, NULL is returned with a memory error</span>
<a name="751" /><span class="True">     751:</span> <span class="k">   exception set. */</span>
<a name="752" /><span class="True">     752:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UCS4</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsUCS4Copy</span><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">)</span><span class="f">;</span>
<a name="753" /><span class="True">     753:</span> <span class="f">#</span><span class="n">endif</span>
<a name="754" /><span class="True">     754:</span> 
<a name="755" /><span class="True">     755:</span> <span class="k">/* Return a read-only pointer to the Unicode object&apos;s internal</span>
<a name="756" /><span class="True">     756:</span> <span class="k">   Py_UNICODE buffer.</span>
<a name="757" /><span class="True">     757:</span> <span class="k">   If the wchar_t/Py_UNICODE representation is not yet available, this</span>
<a name="758" /><span class="True">     758:</span> <span class="k">   function will calculate it. */</span>
<a name="759" /><span class="True">     759:</span> 
<a name="760" /><span class="True">     760:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="761" /><span class="True">     761:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UNICODE</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsUnicode</span><span class="f">(</span>
<a name="762" /><span class="True">     762:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>           <span class="k">/* Unicode object */</span>
<a name="763" /><span class="True">     763:</span>     <span class="f">)</span><span class="f">;</span>
<a name="764" /><span class="True">     764:</span> <span class="f">#</span><span class="n">endif</span>
<a name="765" /><span class="True">     765:</span> 
<a name="766" /><span class="True">     766:</span> <span class="k">/* Return a read-only pointer to the Unicode object&apos;s internal</span>
<a name="767" /><span class="True">     767:</span> <span class="k">   Py_UNICODE buffer and save the length at size.</span>
<a name="768" /><span class="True">     768:</span> <span class="k">   If the wchar_t/Py_UNICODE representation is not yet available, this</span>
<a name="769" /><span class="True">     769:</span> <span class="k">   function will calculate it. */</span>
<a name="770" /><span class="True">     770:</span> 
<a name="771" /><span class="True">     771:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="772" /><span class="True">     772:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UNICODE</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsUnicodeAndSize</span><span class="f">(</span>
<a name="773" /><span class="True">     773:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>          <span class="k">/* Unicode object */</span>
<a name="774" /><span class="True">     774:</span>     <span class="b">Py_ssize_t</span> <span class="f">*</span><span class="b">size</span>            <span class="k">/* location where to save the length */</span>
<a name="775" /><span class="True">     775:</span>     <span class="f">)</span><span class="f">;</span>
<a name="776" /><span class="True">     776:</span> <span class="f">#</span><span class="n">endif</span>
<a name="777" /><span class="True">     777:</span> 
<a name="778" /><span class="True">     778:</span> <span class="f">#</span><span class="n">if</span> <span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">Py_LIMITED_API</span><span class="f">)</span> <span class="f">||</span> <span class="b">Py_LIMITED_API</span><span class="f">+</span><span class="c">0</span> <span class="f">&gt;=</span> <span class="c">0x03030000</span>
<a name="779" /><span class="True">     779:</span> <span class="k">/* Get the length of the Unicode object. */</span>
<a name="780" /><span class="True">     780:</span> 
<a name="781" /><span class="True">     781:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_ssize_t</span><span class="f">)</span> <span class="b">PyUnicode_GetLength</span><span class="f">(</span>
<a name="782" /><span class="True">     782:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>
<a name="783" /><span class="True">     783:</span> <span class="f">)</span><span class="f">;</span>
<a name="784" /><span class="True">     784:</span> <span class="f">#</span><span class="n">endif</span>
<a name="785" /><span class="True">     785:</span> 
<a name="786" /><span class="True">     786:</span> <span class="k">/* Get the number of Py_UNICODE units in the</span>
<a name="787" /><span class="True">     787:</span> <span class="k">   string representation. */</span>
<a name="788" /><span class="True">     788:</span> 
<a name="789" /><span class="True">     789:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_ssize_t</span><span class="f">)</span> <span class="b">PyUnicode_GetSize</span><span class="f">(</span>
<a name="790" /><span class="True">     790:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>           <span class="k">/* Unicode object */</span>
<a name="791" /><span class="True">     791:</span>     <span class="f">)</span><span class="f">;</span>
<a name="792" /><span class="True">     792:</span> 
<a name="793" /><span class="True">     793:</span> <span class="f">#</span><span class="n">if</span> <span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">Py_LIMITED_API</span><span class="f">)</span> <span class="f">||</span> <span class="b">Py_LIMITED_API</span><span class="f">+</span><span class="c">0</span> <span class="f">&gt;=</span> <span class="c">0x03030000</span>
<a name="794" /><span class="True">     794:</span> <span class="k">/* Read a character from the string. */</span>
<a name="795" /><span class="True">     795:</span> 
<a name="796" /><span class="True">     796:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UCS4</span><span class="f">)</span> <span class="b">PyUnicode_ReadChar</span><span class="f">(</span>
<a name="797" /><span class="True">     797:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>
<a name="798" /><span class="True">     798:</span>     <span class="b">Py_ssize_t</span> <span class="b">index</span>
<a name="799" /><span class="True">     799:</span>     <span class="f">)</span><span class="f">;</span>
<a name="800" /><span class="True">     800:</span> 
<a name="801" /><span class="True">     801:</span> <span class="k">/* Write a character to the string. The string must have been created through</span>
<a name="802" /><span class="True">     802:</span> <span class="k">   PyUnicode_New, must not be shared, and must not have been hashed yet.</span>
<a name="803" /><span class="True">     803:</span> <span class="k"></span>
<a name="804" /><span class="True">     804:</span> <span class="k">   Return 0 on success, -1 on error. */</span>
<a name="805" /><span class="True">     805:</span> 
<a name="806" /><span class="True">     806:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">PyUnicode_WriteChar</span><span class="f">(</span>
<a name="807" /><span class="True">     807:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>
<a name="808" /><span class="True">     808:</span>     <span class="b">Py_ssize_t</span> <span class="b">index</span><span class="f">,</span>
<a name="809" /><span class="True">     809:</span>     <span class="b">Py_UCS4</span> <span class="b">character</span>
<a name="810" /><span class="True">     810:</span>     <span class="f">)</span><span class="f">;</span>
<a name="811" /><span class="True">     811:</span> <span class="f">#</span><span class="n">endif</span>
<a name="812" /><span class="True">     812:</span> 
<a name="813" /><span class="True">     813:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="814" /><span class="True">     814:</span> <span class="k">/* Get the maximum ordinal for a Unicode character. */</span>
<a name="815" /><span class="True">     815:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UNICODE</span><span class="f">)</span> <span class="b">PyUnicode_GetMax</span><span class="f">(</span><span class="m">void</span><span class="f">)</span><span class="f">;</span>
<a name="816" /><span class="True">     816:</span> <span class="f">#</span><span class="n">endif</span>
<a name="817" /><span class="True">     817:</span> 
<a name="818" /><span class="True">     818:</span> <span class="k">/* Resize a Unicode object. The length is the number of characters, except</span>
<a name="819" /><span class="True">     819:</span> <span class="k">   if the kind of the string is PyUnicode_WCHAR_KIND: in this case, the length</span>
<a name="820" /><span class="True">     820:</span> <span class="k">   is the number of Py_UNICODE characters.</span>
<a name="821" /><span class="True">     821:</span> <span class="k"></span>
<a name="822" /><span class="True">     822:</span> <span class="k">   *unicode is modified to point to the new (resized) object and 0</span>
<a name="823" /><span class="True">     823:</span> <span class="k">   returned on success.</span>
<a name="824" /><span class="True">     824:</span> <span class="k"></span>
<a name="825" /><span class="True">     825:</span> <span class="k">   Try to resize the string in place (which is usually faster than allocating</span>
<a name="826" /><span class="True">     826:</span> <span class="k">   a new string and copy characters), or create a new string.</span>
<a name="827" /><span class="True">     827:</span> <span class="k"></span>
<a name="828" /><span class="True">     828:</span> <span class="k">   Error handling is implemented as follows: an exception is set, -1</span>
<a name="829" /><span class="True">     829:</span> <span class="k">   is returned and *unicode left untouched.</span>
<a name="830" /><span class="True">     830:</span> <span class="k"></span>
<a name="831" /><span class="True">     831:</span> <span class="k">   WARNING: The function doesn&apos;t check string content, the result may not be a</span>
<a name="832" /><span class="True">     832:</span> <span class="k">            string in canonical representation. */</span>
<a name="833" /><span class="True">     833:</span> 
<a name="834" /><span class="True">     834:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">PyUnicode_Resize</span><span class="f">(</span>
<a name="835" /><span class="True">     835:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="f">*</span><span class="b">unicode</span><span class="f">,</span>         <span class="k">/* Pointer to the Unicode object */</span>
<a name="836" /><span class="True">     836:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span>           <span class="k">/* New length */</span>
<a name="837" /><span class="True">     837:</span>     <span class="f">)</span><span class="f">;</span>
<a name="838" /><span class="True">     838:</span> 
<a name="839" /><span class="True">     839:</span> <span class="k">/* Decode obj to a Unicode object.</span>
<a name="840" /><span class="True">     840:</span> <span class="k"></span>
<a name="841" /><span class="True">     841:</span> <span class="k">   bytes, bytearray and other bytes-like objects are decoded according to the</span>
<a name="842" /><span class="True">     842:</span> <span class="k">   given encoding and error handler. The encoding and error handler can be</span>
<a name="843" /><span class="True">     843:</span> <span class="k">   NULL to have the interface use UTF-8 and &quot;strict&quot;.</span>
<a name="844" /><span class="True">     844:</span> <span class="k"></span>
<a name="845" /><span class="True">     845:</span> <span class="k">   All other objects (including Unicode objects) raise an exception.</span>
<a name="846" /><span class="True">     846:</span> <span class="k"></span>
<a name="847" /><span class="True">     847:</span> <span class="k">   The API returns NULL in case of an error. The caller is responsible</span>
<a name="848" /><span class="True">     848:</span> <span class="k">   for decref&apos;ing the returned objects.</span>
<a name="849" /><span class="True">     849:</span> <span class="k"></span>
<a name="850" /><span class="True">     850:</span> <span class="k">*/</span>
<a name="851" /><span class="True">     851:</span> 
<a name="852" /><span class="True">     852:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_FromEncodedObject</span><span class="f">(</span>
<a name="853" /><span class="True">     853:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">obj</span><span class="f">,</span>              <span class="k">/* Object */</span>
<a name="854" /><span class="True">     854:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">encoding</span><span class="f">,</span>       <span class="k">/* encoding */</span>
<a name="855" /><span class="True">     855:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="856" /><span class="True">     856:</span>     <span class="f">)</span><span class="f">;</span>
<a name="857" /><span class="True">     857:</span> 
<a name="858" /><span class="True">     858:</span> <span class="k">/* Copy an instance of a Unicode subtype to a new true Unicode object if</span>
<a name="859" /><span class="True">     859:</span> <span class="k">   necessary. If obj is already a true Unicode object (not a subtype), return</span>
<a name="860" /><span class="True">     860:</span> <span class="k">   the reference with *incremented* refcount.</span>
<a name="861" /><span class="True">     861:</span> <span class="k"></span>
<a name="862" /><span class="True">     862:</span> <span class="k">   The API returns NULL in case of an error. The caller is responsible</span>
<a name="863" /><span class="True">     863:</span> <span class="k">   for decref&apos;ing the returned objects.</span>
<a name="864" /><span class="True">     864:</span> <span class="k"></span>
<a name="865" /><span class="True">     865:</span> <span class="k">*/</span>
<a name="866" /><span class="True">     866:</span> 
<a name="867" /><span class="True">     867:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_FromObject</span><span class="f">(</span>
<a name="868" /><span class="True">     868:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">obj</span>      <span class="k">/* Object */</span>
<a name="869" /><span class="True">     869:</span>     <span class="f">)</span><span class="f">;</span>
<a name="870" /><span class="True">     870:</span> 
<a name="871" /><span class="True">     871:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_FromFormatV</span><span class="f">(</span>
<a name="872" /><span class="True">     872:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">format</span><span class="f">,</span>   <span class="k">/* ASCII-encoded string  */</span>
<a name="873" /><span class="True">     873:</span>     <span class="b">va_list</span> <span class="b">vargs</span>
<a name="874" /><span class="True">     874:</span>     <span class="f">)</span><span class="f">;</span>
<a name="875" /><span class="True">     875:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_FromFormat</span><span class="f">(</span>
<a name="876" /><span class="True">     876:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">format</span><span class="f">,</span>   <span class="k">/* ASCII-encoded string  */</span>
<a name="877" /><span class="True">     877:</span>     <span class="f">...</span>
<a name="878" /><span class="True">     878:</span>     <span class="f">)</span><span class="f">;</span>
<a name="879" /><span class="True">     879:</span> 
<a name="880" /><span class="True">     880:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="881" /><span class="True">     881:</span> <span class="m">typedef</span> <span class="m">struct</span> <span class="f">{</span>
<a name="882" /><span class="True">     882:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">buffer</span><span class="f">;</span>
<a name="883" /><span class="True">     883:</span>     <span class="m">void</span> <span class="f">*</span><span class="b">data</span><span class="f">;</span>
<a name="884" /><span class="True">     884:</span>     <span class="m">enum</span> <span class="b">PyUnicode_Kind</span> <span class="b">kind</span><span class="f">;</span>
<a name="885" /><span class="True">     885:</span>     <span class="b">Py_UCS4</span> <span class="b">maxchar</span><span class="f">;</span>
<a name="886" /><span class="True">     886:</span>     <span class="b">Py_ssize_t</span> <span class="b">size</span><span class="f">;</span>
<a name="887" /><span class="True">     887:</span>     <span class="b">Py_ssize_t</span> <span class="b">pos</span><span class="f">;</span>
<a name="888" /><span class="True">     888:</span> 
<a name="889" /><span class="True">     889:</span>     <span class="k">/* minimum number of allocated characters (default: 0) */</span>
<a name="890" /><span class="True">     890:</span>     <span class="b">Py_ssize_t</span> <span class="b">min_length</span><span class="f">;</span>
<a name="891" /><span class="True">     891:</span> 
<a name="892" /><span class="True">     892:</span>     <span class="k">/* minimum character (default: 127, ASCII) */</span>
<a name="893" /><span class="True">     893:</span>     <span class="b">Py_UCS4</span> <span class="b">min_char</span><span class="f">;</span>
<a name="894" /><span class="True">     894:</span> 
<a name="895" /><span class="True">     895:</span>     <span class="k">/* If non-zero, overallocate the buffer (default: 0). */</span>
<a name="896" /><span class="True">     896:</span>     <span class="m">unsigned</span> <span class="m">char</span> <span class="b">overallocate</span><span class="f">;</span>
<a name="897" /><span class="True">     897:</span> 
<a name="898" /><span class="True">     898:</span>     <span class="k">/* If readonly is 1, buffer is a shared string (cannot be modified)</span>
<a name="899" /><span class="True">     899:</span> <span class="k">       and size is set to 0. */</span>
<a name="900" /><span class="True">     900:</span>     <span class="m">unsigned</span> <span class="m">char</span> <span class="b">readonly</span><span class="f">;</span>
<a name="901" /><span class="True">     901:</span> <span class="f">}</span> <span class="b">_PyUnicodeWriter</span> <span class="f">;</span>
<a name="902" /><span class="True">     902:</span> 
<a name="903" /><span class="True">     903:</span> <span class="k">/* Initialize a Unicode writer.</span>
<a name="904" /><span class="True">     904:</span> <span class="k"> *</span>
<a name="905" /><span class="True">     905:</span> <span class="k"> * By default, the minimum buffer size is 0 character and overallocation is</span>
<a name="906" /><span class="True">     906:</span> <span class="k"> * disabled. Set min_length, min_char and overallocate attributes to control</span>
<a name="907" /><span class="True">     907:</span> <span class="k"> * the allocation of the buffer. */</span>
<a name="908" /><span class="True">     908:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="909" /><span class="True">     909:</span> <span class="b">_PyUnicodeWriter_Init</span><span class="f">(</span><span class="b">_PyUnicodeWriter</span> <span class="f">*</span><span class="b">writer</span><span class="f">)</span><span class="f">;</span>
<a name="910" /><span class="True">     910:</span> 
<a name="911" /><span class="True">     911:</span> <span class="k">/* Prepare the buffer to write &apos;length&apos; characters</span>
<a name="912" /><span class="True">     912:</span> <span class="k">   with the specified maximum character.</span>
<a name="913" /><span class="True">     913:</span> <span class="k"></span>
<a name="914" /><span class="True">     914:</span> <span class="k">   Return 0 on success, raise an exception and return -1 on error. */</span>
<a name="915" /><span class="True">     915:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_X1B5VW5pY29kZVdyaXRlcl9QcmVwYXJlXzA_"><span class="b">_PyUnicodeWriter_Prepare</span></a><span class="f">(</span><span class="b">WRITER</span><span class="f">,</span> <span class="b">LENGTH</span><span class="f">,</span> <span class="b">MAXCHAR</span><span class="f">)</span>             \
<a name="916" /><span class="True">     916:</span>     <span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">MAXCHAR</span><span class="f">)</span> <span class="f">&lt;=</span> <span class="f">(</span><span class="b">WRITER</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">maxchar</span>                                  \
<a name="917" /><span class="True">     917:</span>       <span class="f">&amp;&amp;</span> <span class="f">(</span><span class="b">LENGTH</span><span class="f">)</span> <span class="f">&lt;=</span> <span class="f">(</span><span class="b">WRITER</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">size</span> <span class="f">-</span> <span class="f">(</span><span class="b">WRITER</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">pos</span><span class="f">)</span>                  \
<a name="918" /><span class="True">     918:</span>      <span class="f">?</span> <span class="c">0</span>                                                              \
<a name="919" /><span class="True">     919:</span>      <span class="f">:</span> <span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">LENGTH</span><span class="f">)</span> <span class="f">==</span> <span class="c">0</span><span class="f">)</span>                                               \
<a name="920" /><span class="True">     920:</span>         <span class="f">?</span> <span class="c">0</span>                                                           \
<a name="921" /><span class="True">     921:</span>         <span class="f">:</span> <span class="b">_PyUnicodeWriter_PrepareInternal</span><span class="f">(</span><span class="f">(</span><span class="b">WRITER</span><span class="f">)</span><span class="f">,</span> <span class="f">(</span><span class="b">LENGTH</span><span class="f">)</span><span class="f">,</span> <span class="f">(</span><span class="b">MAXCHAR</span><span class="f">)</span><span class="f">)</span><span class="f">)</span><span class="f">)</span>
<a name="922" /><span class="True">     922:</span> 
<a name="923" /><span class="True">     923:</span> <span class="k">/* Don&apos;t call this function directly, use the _PyUnicodeWriter_Prepare() macro</span>
<a name="924" /><span class="True">     924:</span> <span class="k">   instead. */</span>
<a name="925" /><span class="True">     925:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span>
<a name="926" /><span class="True">     926:</span> <span class="b">_PyUnicodeWriter_PrepareInternal</span><span class="f">(</span><span class="b">_PyUnicodeWriter</span> <span class="f">*</span><span class="b">writer</span><span class="f">,</span>
<a name="927" /><span class="True">     927:</span>                                  <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span> <span class="b">Py_UCS4</span> <span class="b">maxchar</span><span class="f">)</span><span class="f">;</span>
<a name="928" /><span class="True">     928:</span> 
<a name="929" /><span class="True">     929:</span> <span class="k">/* Prepare the buffer to have at least the kind KIND.</span>
<a name="930" /><span class="True">     930:</span> <span class="k">   For example, kind=PyUnicode_2BYTE_KIND ensures that the writer will</span>
<a name="931" /><span class="True">     931:</span> <span class="k">   support characters in range U+000-U+FFFF.</span>
<a name="932" /><span class="True">     932:</span> <span class="k"></span>
<a name="933" /><span class="True">     933:</span> <span class="k">   Return 0 on success, raise an exception and return -1 on error. */</span>
<a name="934" /><span class="True">     934:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_X1B5VW5pY29kZVdyaXRlcl9QcmVwYXJlS2luZF8w"><span class="b">_PyUnicodeWriter_PrepareKind</span></a><span class="f">(</span><span class="b">WRITER</span><span class="f">,</span> <span class="b">KIND</span><span class="f">)</span>                    \
<a name="935" /><span class="True">     935:</span>     <span class="f">(</span><a href="macros_ref.html#_YXNzZXJ0XzA_"><span class="b">assert</span></a><span class="f">(</span><span class="f">(</span><span class="b">KIND</span><span class="f">)</span> <span class="f">!=</span> <span class="b">PyUnicode_WCHAR_KIND</span><span class="f">)</span><span class="f">,</span>                          \
<a name="936" /><span class="True">     936:</span>      <span class="f">(</span><span class="b">KIND</span><span class="f">)</span> <span class="f">&lt;=</span> <span class="f">(</span><span class="b">WRITER</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">kind</span>                                         \
<a name="937" /><span class="True">     937:</span>      <span class="f">?</span> <span class="c">0</span>                                                              \
<a name="938" /><span class="True">     938:</span>      <span class="f">:</span> <span class="b">_PyUnicodeWriter_PrepareKindInternal</span><span class="f">(</span><span class="f">(</span><span class="b">WRITER</span><span class="f">)</span><span class="f">,</span> <span class="f">(</span><span class="b">KIND</span><span class="f">)</span><span class="f">)</span><span class="f">)</span>
<a name="939" /><span class="True">     939:</span> 
<a name="940" /><span class="True">     940:</span> <span class="k">/* Don&apos;t call this function directly, use the _PyUnicodeWriter_PrepareKind()</span>
<a name="941" /><span class="True">     941:</span> <span class="k">   macro instead. */</span>
<a name="942" /><span class="True">     942:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span>
<a name="943" /><span class="True">     943:</span> <span class="b">_PyUnicodeWriter_PrepareKindInternal</span><span class="f">(</span><span class="b">_PyUnicodeWriter</span> <span class="f">*</span><span class="b">writer</span><span class="f">,</span>
<a name="944" /><span class="True">     944:</span>                                      <span class="m">enum</span> <span class="b">PyUnicode_Kind</span> <span class="b">kind</span><span class="f">)</span><span class="f">;</span>
<a name="945" /><span class="True">     945:</span> 
<a name="946" /><span class="True">     946:</span> <span class="k">/* Append a Unicode character.</span>
<a name="947" /><span class="True">     947:</span> <span class="k">   Return 0 on success, raise an exception and return -1 on error. */</span>
<a name="948" /><span class="True">     948:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span>
<a name="949" /><span class="True">     949:</span> <span class="b">_PyUnicodeWriter_WriteChar</span><span class="f">(</span><span class="b">_PyUnicodeWriter</span> <span class="f">*</span><span class="b">writer</span><span class="f">,</span>
<a name="950" /><span class="True">     950:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>
<a name="951" /><span class="True">     951:</span>     <span class="f">)</span><span class="f">;</span>
<a name="952" /><span class="True">     952:</span> 
<a name="953" /><span class="True">     953:</span> <span class="k">/* Append a Unicode string.</span>
<a name="954" /><span class="True">     954:</span> <span class="k">   Return 0 on success, raise an exception and return -1 on error. */</span>
<a name="955" /><span class="True">     955:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span>
<a name="956" /><span class="True">     956:</span> <span class="b">_PyUnicodeWriter_WriteStr</span><span class="f">(</span><span class="b">_PyUnicodeWriter</span> <span class="f">*</span><span class="b">writer</span><span class="f">,</span>
<a name="957" /><span class="True">     957:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">str</span>               <span class="k">/* Unicode string */</span>
<a name="958" /><span class="True">     958:</span>     <span class="f">)</span><span class="f">;</span>
<a name="959" /><span class="True">     959:</span> 
<a name="960" /><span class="True">     960:</span> <span class="k">/* Append a substring of a Unicode string.</span>
<a name="961" /><span class="True">     961:</span> <span class="k">   Return 0 on success, raise an exception and return -1 on error. */</span>
<a name="962" /><span class="True">     962:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span>
<a name="963" /><span class="True">     963:</span> <span class="b">_PyUnicodeWriter_WriteSubstring</span><span class="f">(</span><span class="b">_PyUnicodeWriter</span> <span class="f">*</span><span class="b">writer</span><span class="f">,</span>
<a name="964" /><span class="True">     964:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">str</span><span class="f">,</span>              <span class="k">/* Unicode string */</span>
<a name="965" /><span class="True">     965:</span>     <span class="b">Py_ssize_t</span> <span class="b">start</span><span class="f">,</span>
<a name="966" /><span class="True">     966:</span>     <span class="b">Py_ssize_t</span> <span class="b">end</span>
<a name="967" /><span class="True">     967:</span>     <span class="f">)</span><span class="f">;</span>
<a name="968" /><span class="True">     968:</span> 
<a name="969" /><span class="True">     969:</span> <span class="k">/* Append an ASCII-encoded byte string.</span>
<a name="970" /><span class="True">     970:</span> <span class="k">   Return 0 on success, raise an exception and return -1 on error. */</span>
<a name="971" /><span class="True">     971:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span>
<a name="972" /><span class="True">     972:</span> <span class="b">_PyUnicodeWriter_WriteASCIIString</span><span class="f">(</span><span class="b">_PyUnicodeWriter</span> <span class="f">*</span><span class="b">writer</span><span class="f">,</span>
<a name="973" /><span class="True">     973:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">str</span><span class="f">,</span>           <span class="k">/* ASCII-encoded byte string */</span>
<a name="974" /><span class="True">     974:</span>     <span class="b">Py_ssize_t</span> <span class="b">len</span>             <span class="k">/* number of bytes, or -1 if unknown */</span>
<a name="975" /><span class="True">     975:</span>     <span class="f">)</span><span class="f">;</span>
<a name="976" /><span class="True">     976:</span> 
<a name="977" /><span class="True">     977:</span> <span class="k">/* Append a latin1-encoded byte string.</span>
<a name="978" /><span class="True">     978:</span> <span class="k">   Return 0 on success, raise an exception and return -1 on error. */</span>
<a name="979" /><span class="True">     979:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span>
<a name="980" /><span class="True">     980:</span> <span class="b">_PyUnicodeWriter_WriteLatin1String</span><span class="f">(</span><span class="b">_PyUnicodeWriter</span> <span class="f">*</span><span class="b">writer</span><span class="f">,</span>
<a name="981" /><span class="True">     981:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">str</span><span class="f">,</span>           <span class="k">/* latin1-encoded byte string */</span>
<a name="982" /><span class="True">     982:</span>     <span class="b">Py_ssize_t</span> <span class="b">len</span>             <span class="k">/* length in bytes */</span>
<a name="983" /><span class="True">     983:</span>     <span class="f">)</span><span class="f">;</span>
<a name="984" /><span class="True">     984:</span> 
<a name="985" /><span class="True">     985:</span> <span class="k">/* Get the value of the writer as a Unicode string. Clear the</span>
<a name="986" /><span class="True">     986:</span> <span class="k">   buffer of the writer. Raise an exception and return NULL</span>
<a name="987" /><span class="True">     987:</span> <span class="k">   on error. */</span>
<a name="988" /><span class="True">     988:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span>
<a name="989" /><span class="True">     989:</span> <span class="b">_PyUnicodeWriter_Finish</span><span class="f">(</span><span class="b">_PyUnicodeWriter</span> <span class="f">*</span><span class="b">writer</span><span class="f">)</span><span class="f">;</span>
<a name="990" /><span class="True">     990:</span> 
<a name="991" /><span class="True">     991:</span> <span class="k">/* Deallocate memory of a writer (clear its internal buffer). */</span>
<a name="992" /><span class="True">     992:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="993" /><span class="True">     993:</span> <span class="b">_PyUnicodeWriter_Dealloc</span><span class="f">(</span><span class="b">_PyUnicodeWriter</span> <span class="f">*</span><span class="b">writer</span><span class="f">)</span><span class="f">;</span>
<a name="994" /><span class="True">     994:</span> <span class="f">#</span><span class="n">endif</span>
<a name="995" /><span class="True">     995:</span> 
<a name="996" /><span class="True">     996:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="997" /><span class="True">     997:</span> <span class="k">/* Format the object based on the format_spec, as defined in PEP 3101</span>
<a name="998" /><span class="True">     998:</span> <span class="k">   (Advanced String Formatting). */</span>
<a name="999" /><span class="True">     999:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_FormatAdvancedWriter</span><span class="f">(</span>
<a name="1000" /><span class="True">    1000:</span>     <span class="b">_PyUnicodeWriter</span> <span class="f">*</span><span class="b">writer</span><span class="f">,</span>
<a name="1001" /><span class="True">    1001:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">obj</span><span class="f">,</span>
<a name="1002" /><span class="True">    1002:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">format_spec</span><span class="f">,</span>
<a name="1003" /><span class="True">    1003:</span>     <span class="b">Py_ssize_t</span> <span class="b">start</span><span class="f">,</span>
<a name="1004" /><span class="True">    1004:</span>     <span class="b">Py_ssize_t</span> <span class="b">end</span><span class="f">)</span><span class="f">;</span>
<a name="1005" /><span class="True">    1005:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1006" /><span class="True">    1006:</span> 
<a name="1007" /><span class="True">    1007:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">void</span><span class="f">)</span> <span class="b">PyUnicode_InternInPlace</span><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">*</span><span class="f">)</span><span class="f">;</span>
<a name="1008" /><span class="True">    1008:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">void</span><span class="f">)</span> <span class="b">PyUnicode_InternImmortal</span><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">*</span><span class="f">)</span><span class="f">;</span>
<a name="1009" /><span class="True">    1009:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_InternFromString</span><span class="f">(</span>
<a name="1010" /><span class="True">    1010:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">u</span>              <span class="k">/* UTF-8 encoded string */</span>
<a name="1011" /><span class="True">    1011:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1012" /><span class="True">    1012:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1013" /><span class="True">    1013:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">void</span><span class="f">)</span> <span class="b">_Py_ReleaseInternedUnicodeStrings</span><span class="f">(</span><span class="m">void</span><span class="f">)</span><span class="f">;</span>
<a name="1014" /><span class="True">    1014:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1015" /><span class="True">    1015:</span> 
<a name="1016" /><span class="True">    1016:</span> <span class="k">/* Use only if you know it&apos;s a string */</span>
<a name="1017" /><span class="True">    1017:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlVbmljb2RlX0NIRUNLX0lOVEVSTkVEXzA_"><span class="b">PyUnicode_CHECK_INTERNED</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> \
<a name="1018" /><span class="True">    1018:</span>     <span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">PyASCIIObject</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">state</span><span class="f">.</span><span class="b">interned</span><span class="f">)</span>
<a name="1019" /><span class="True">    1019:</span> 
<a name="1020" /><span class="True">    1020:</span> <span class="k">/* --- wchar_t support for platforms which support it --------------------- */</span>
<a name="1021" /><span class="True">    1021:</span> 
<a name="1022" /><span class="True">    1022:</span> <span class="f">#</span><span class="n">ifdef</span> <a href="macros_ref.html#_SEFWRV9XQ0hBUl9IXzA_"><span class="b">HAVE_WCHAR_H</span></a>
<a name="1023" /><span class="True">    1023:</span> 
<a name="1024" /><span class="True">    1024:</span> <span class="k">/* Create a Unicode Object from the wchar_t buffer w of the given</span>
<a name="1025" /><span class="True">    1025:</span> <span class="k">   size.</span>
<a name="1026" /><span class="True">    1026:</span> <span class="k"></span>
<a name="1027" /><span class="True">    1027:</span> <span class="k">   The buffer is copied into the new object. */</span>
<a name="1028" /><span class="True">    1028:</span> 
<a name="1029" /><span class="True">    1029:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_FromWideChar</span><span class="f">(</span>
<a name="1030" /><span class="True">    1030:</span>     <span class="m">const</span> <span class="m">wchar_t</span> <span class="f">*</span><span class="b">w</span><span class="f">,</span>           <span class="k">/* wchar_t buffer */</span>
<a name="1031" /><span class="True">    1031:</span>     <span class="b">Py_ssize_t</span> <span class="b">size</span>             <span class="k">/* size of buffer */</span>
<a name="1032" /><span class="True">    1032:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1033" /><span class="True">    1033:</span> 
<a name="1034" /><span class="True">    1034:</span> <span class="k">/* Copies the Unicode Object contents into the wchar_t buffer w.  At</span>
<a name="1035" /><span class="True">    1035:</span> <span class="k">   most size wchar_t characters are copied.</span>
<a name="1036" /><span class="True">    1036:</span> <span class="k"></span>
<a name="1037" /><span class="True">    1037:</span> <span class="k">   Note that the resulting wchar_t string may or may not be</span>
<a name="1038" /><span class="True">    1038:</span> <span class="k">   0-terminated.  It is the responsibility of the caller to make sure</span>
<a name="1039" /><span class="True">    1039:</span> <span class="k">   that the wchar_t string is 0-terminated in case this is required by</span>
<a name="1040" /><span class="True">    1040:</span> <span class="k">   the application.</span>
<a name="1041" /><span class="True">    1041:</span> <span class="k"></span>
<a name="1042" /><span class="True">    1042:</span> <span class="k">   Returns the number of wchar_t characters copied (excluding a</span>
<a name="1043" /><span class="True">    1043:</span> <span class="k">   possibly trailing 0-termination character) or -1 in case of an</span>
<a name="1044" /><span class="True">    1044:</span> <span class="k">   error. */</span>
<a name="1045" /><span class="True">    1045:</span> 
<a name="1046" /><span class="True">    1046:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_ssize_t</span><span class="f">)</span> <span class="b">PyUnicode_AsWideChar</span><span class="f">(</span>
<a name="1047" /><span class="True">    1047:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>          <span class="k">/* Unicode object */</span>
<a name="1048" /><span class="True">    1048:</span>     <span class="m">wchar_t</span> <span class="f">*</span><span class="b">w</span><span class="f">,</span>                 <span class="k">/* wchar_t buffer */</span>
<a name="1049" /><span class="True">    1049:</span>     <span class="b">Py_ssize_t</span> <span class="b">size</span>             <span class="k">/* size of buffer */</span>
<a name="1050" /><span class="True">    1050:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1051" /><span class="True">    1051:</span> 
<a name="1052" /><span class="True">    1052:</span> <span class="k">/* Convert the Unicode object to a wide character string. The output string</span>
<a name="1053" /><span class="True">    1053:</span> <span class="k">   always ends with a nul character. If size is not NULL, write the number of</span>
<a name="1054" /><span class="True">    1054:</span> <span class="k">   wide characters (excluding the null character) into *size.</span>
<a name="1055" /><span class="True">    1055:</span> <span class="k"></span>
<a name="1056" /><span class="True">    1056:</span> <span class="k">   Returns a buffer allocated by PyMem_Malloc() (use PyMem_Free() to free it)</span>
<a name="1057" /><span class="True">    1057:</span> <span class="k">   on success. On error, returns NULL, *size is undefined and raises a</span>
<a name="1058" /><span class="True">    1058:</span> <span class="k">   MemoryError. */</span>
<a name="1059" /><span class="True">    1059:</span> 
<a name="1060" /><span class="True">    1060:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">wchar_t</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsWideCharString</span><span class="f">(</span>
<a name="1061" /><span class="True">    1061:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>          <span class="k">/* Unicode object */</span>
<a name="1062" /><span class="True">    1062:</span>     <span class="b">Py_ssize_t</span> <span class="f">*</span><span class="b">size</span>            <span class="k">/* number of characters of the result */</span>
<a name="1063" /><span class="True">    1063:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1064" /><span class="True">    1064:</span> 
<a name="1065" /><span class="True">    1065:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1066" /><span class="True">    1066:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">void</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_AsKind</span><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="b">s</span><span class="f">,</span> <span class="m">unsigned</span> <span class="m">int</span> <span class="b">kind</span><span class="f">)</span><span class="f">;</span>
<a name="1067" /><span class="True">    1067:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1068" /><span class="True">    1068:</span> 
<a name="1069" /><span class="True">    1069:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1070" /><span class="True">    1070:</span> 
<a name="1071" /><span class="True">    1071:</span> <span class="k">/* --- Unicode ordinals --------------------------------------------------- */</span>
<a name="1072" /><span class="True">    1072:</span> 
<a name="1073" /><span class="True">    1073:</span> <span class="k">/* Create a Unicode Object from the given Unicode code point ordinal.</span>
<a name="1074" /><span class="True">    1074:</span> <span class="k"></span>
<a name="1075" /><span class="True">    1075:</span> <span class="k">   The ordinal must be in range(0x110000). A ValueError is</span>
<a name="1076" /><span class="True">    1076:</span> <span class="k">   raised in case it is not.</span>
<a name="1077" /><span class="True">    1077:</span> <span class="k"></span>
<a name="1078" /><span class="True">    1078:</span> <span class="k">*/</span>
<a name="1079" /><span class="True">    1079:</span> 
<a name="1080" /><span class="True">    1080:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_FromOrdinal</span><span class="f">(</span><span class="m">int</span> <span class="b">ordinal</span><span class="f">)</span><span class="f">;</span>
<a name="1081" /><span class="True">    1081:</span> 
<a name="1082" /><span class="True">    1082:</span> <span class="k">/* --- Free-list management ----------------------------------------------- */</span>
<a name="1083" /><span class="True">    1083:</span> 
<a name="1084" /><span class="True">    1084:</span> <span class="k">/* Clear the free list used by the Unicode implementation.</span>
<a name="1085" /><span class="True">    1085:</span> <span class="k"></span>
<a name="1086" /><span class="True">    1086:</span> <span class="k">   This can be used to release memory used for objects on the free</span>
<a name="1087" /><span class="True">    1087:</span> <span class="k">   list back to the Python memory allocator.</span>
<a name="1088" /><span class="True">    1088:</span> <span class="k"></span>
<a name="1089" /><span class="True">    1089:</span> <span class="k">*/</span>
<a name="1090" /><span class="True">    1090:</span> 
<a name="1091" /><span class="True">    1091:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">PyUnicode_ClearFreeList</span><span class="f">(</span><span class="m">void</span><span class="f">)</span><span class="f">;</span>
<a name="1092" /><span class="True">    1092:</span> 
<a name="1093" /><span class="True">    1093:</span> <span class="k">/* === Builtin Codecs =====================================================</span>
<a name="1094" /><span class="True">    1094:</span> <span class="k"></span>
<a name="1095" /><span class="True">    1095:</span> <span class="k">   Many of these APIs take two arguments encoding and errors. These</span>
<a name="1096" /><span class="True">    1096:</span> <span class="k">   parameters encoding and errors have the same semantics as the ones</span>
<a name="1097" /><span class="True">    1097:</span> <span class="k">   of the builtin str() API.</span>
<a name="1098" /><span class="True">    1098:</span> <span class="k"></span>
<a name="1099" /><span class="True">    1099:</span> <span class="k">   Setting encoding to NULL causes the default encoding (UTF-8) to be used.</span>
<a name="1100" /><span class="True">    1100:</span> <span class="k"></span>
<a name="1101" /><span class="True">    1101:</span> <span class="k">   Error handling is set by errors which may also be set to NULL</span>
<a name="1102" /><span class="True">    1102:</span> <span class="k">   meaning to use the default handling defined for the codec. Default</span>
<a name="1103" /><span class="True">    1103:</span> <span class="k">   error handling for all builtin codecs is &quot;strict&quot; (ValueErrors are</span>
<a name="1104" /><span class="True">    1104:</span> <span class="k">   raised).</span>
<a name="1105" /><span class="True">    1105:</span> <span class="k"></span>
<a name="1106" /><span class="True">    1106:</span> <span class="k">   The codecs all use a similar interface. Only deviation from the</span>
<a name="1107" /><span class="True">    1107:</span> <span class="k">   generic ones are documented.</span>
<a name="1108" /><span class="True">    1108:</span> <span class="k"></span>
<a name="1109" /><span class="True">    1109:</span> <span class="k">*/</span>
<a name="1110" /><span class="True">    1110:</span> 
<a name="1111" /><span class="True">    1111:</span> <span class="k">/* --- Manage the default encoding ---------------------------------------- */</span>
<a name="1112" /><span class="True">    1112:</span> 
<a name="1113" /><span class="True">    1113:</span> <span class="k">/* Returns a pointer to the default encoding (UTF-8) of the</span>
<a name="1114" /><span class="True">    1114:</span> <span class="k">   Unicode object unicode and the size of the encoded representation</span>
<a name="1115" /><span class="True">    1115:</span> <span class="k">   in bytes stored in *size.</span>
<a name="1116" /><span class="True">    1116:</span> <span class="k"></span>
<a name="1117" /><span class="True">    1117:</span> <span class="k">   In case of an error, no *size is set.</span>
<a name="1118" /><span class="True">    1118:</span> <span class="k"></span>
<a name="1119" /><span class="True">    1119:</span> <span class="k">   This function caches the UTF-8 encoded string in the unicodeobject</span>
<a name="1120" /><span class="True">    1120:</span> <span class="k">   and subsequent calls will return the same string.  The memory is released</span>
<a name="1121" /><span class="True">    1121:</span> <span class="k">   when the unicodeobject is deallocated.</span>
<a name="1122" /><span class="True">    1122:</span> <span class="k"></span>
<a name="1123" /><span class="True">    1123:</span> <span class="k">   _PyUnicode_AsStringAndSize is a #define for PyUnicode_AsUTF8AndSize to</span>
<a name="1124" /><span class="True">    1124:</span> <span class="k">   support the previous internal function with the same behaviour.</span>
<a name="1125" /><span class="True">    1125:</span> <span class="k"></span>
<a name="1126" /><span class="True">    1126:</span> <span class="k">   *** This API is for interpreter INTERNAL USE ONLY and will likely</span>
<a name="1127" /><span class="True">    1127:</span> <span class="k">   *** be removed or changed in the future.</span>
<a name="1128" /><span class="True">    1128:</span> <span class="k"></span>
<a name="1129" /><span class="True">    1129:</span> <span class="k">   *** If you need to access the Unicode object as UTF-8 bytes string,</span>
<a name="1130" /><span class="True">    1130:</span> <span class="k">   *** please use PyUnicode_AsUTF8String() instead.</span>
<a name="1131" /><span class="True">    1131:</span> <span class="k">*/</span>
<a name="1132" /><span class="True">    1132:</span> 
<a name="1133" /><span class="True">    1133:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1134" /><span class="True">    1134:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">char</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsUTF8AndSize</span><span class="f">(</span>
<a name="1135" /><span class="True">    1135:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>
<a name="1136" /><span class="True">    1136:</span>     <span class="b">Py_ssize_t</span> <span class="f">*</span><span class="b">size</span><span class="f">)</span><span class="f">;</span>
<a name="1137" /><span class="True">    1137:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_X1B5VW5pY29kZV9Bc1N0cmluZ0FuZFNpemVfMA__"><span class="b">_PyUnicode_AsStringAndSize</span></a> <span class="b">PyUnicode_AsUTF8AndSize</span>
<a name="1138" /><span class="True">    1138:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1139" /><span class="True">    1139:</span> 
<a name="1140" /><span class="True">    1140:</span> <span class="k">/* Returns a pointer to the default encoding (UTF-8) of the</span>
<a name="1141" /><span class="True">    1141:</span> <span class="k">   Unicode object unicode.</span>
<a name="1142" /><span class="True">    1142:</span> <span class="k"></span>
<a name="1143" /><span class="True">    1143:</span> <span class="k">   Like PyUnicode_AsUTF8AndSize(), this also caches the UTF-8 representation</span>
<a name="1144" /><span class="True">    1144:</span> <span class="k">   in the unicodeobject.</span>
<a name="1145" /><span class="True">    1145:</span> <span class="k"></span>
<a name="1146" /><span class="True">    1146:</span> <span class="k">   _PyUnicode_AsString is a #define for PyUnicode_AsUTF8 to</span>
<a name="1147" /><span class="True">    1147:</span> <span class="k">   support the previous internal function with the same behaviour.</span>
<a name="1148" /><span class="True">    1148:</span> <span class="k"></span>
<a name="1149" /><span class="True">    1149:</span> <span class="k">   Use of this API is DEPRECATED since no size information can be</span>
<a name="1150" /><span class="True">    1150:</span> <span class="k">   extracted from the returned data.</span>
<a name="1151" /><span class="True">    1151:</span> <span class="k"></span>
<a name="1152" /><span class="True">    1152:</span> <span class="k">   *** This API is for interpreter INTERNAL USE ONLY and will likely</span>
<a name="1153" /><span class="True">    1153:</span> <span class="k">   *** be removed or changed for Python 3.1.</span>
<a name="1154" /><span class="True">    1154:</span> <span class="k"></span>
<a name="1155" /><span class="True">    1155:</span> <span class="k">   *** If you need to access the Unicode object as UTF-8 bytes string,</span>
<a name="1156" /><span class="True">    1156:</span> <span class="k">   *** please use PyUnicode_AsUTF8String() instead.</span>
<a name="1157" /><span class="True">    1157:</span> <span class="k"></span>
<a name="1158" /><span class="True">    1158:</span> <span class="k">*/</span>
<a name="1159" /><span class="True">    1159:</span> 
<a name="1160" /><span class="True">    1160:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1161" /><span class="True">    1161:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">char</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsUTF8</span><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">)</span><span class="f">;</span>
<a name="1162" /><span class="True">    1162:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_X1B5VW5pY29kZV9Bc1N0cmluZ18w"><span class="b">_PyUnicode_AsString</span></a> <span class="b">PyUnicode_AsUTF8</span>
<a name="1163" /><span class="True">    1163:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1164" /><span class="True">    1164:</span> 
<a name="1165" /><span class="True">    1165:</span> <span class="k">/* Returns &quot;utf-8&quot;.  */</span>
<a name="1166" /><span class="True">    1166:</span> 
<a name="1167" /><span class="True">    1167:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">const</span> <span class="m">char</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_GetDefaultEncoding</span><span class="f">(</span><span class="m">void</span><span class="f">)</span><span class="f">;</span>
<a name="1168" /><span class="True">    1168:</span> 
<a name="1169" /><span class="True">    1169:</span> <span class="k">/* --- Generic Codecs ----------------------------------------------------- */</span>
<a name="1170" /><span class="True">    1170:</span> 
<a name="1171" /><span class="True">    1171:</span> <span class="k">/* Create a Unicode object by decoding the encoded string s of the</span>
<a name="1172" /><span class="True">    1172:</span> <span class="k">   given size. */</span>
<a name="1173" /><span class="True">    1173:</span> 
<a name="1174" /><span class="True">    1174:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_Decode</span><span class="f">(</span>
<a name="1175" /><span class="True">    1175:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">s</span><span class="f">,</span>              <span class="k">/* encoded string */</span>
<a name="1176" /><span class="True">    1176:</span>     <span class="b">Py_ssize_t</span> <span class="b">size</span><span class="f">,</span>            <span class="k">/* size of buffer */</span>
<a name="1177" /><span class="True">    1177:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">encoding</span><span class="f">,</span>       <span class="k">/* encoding */</span>
<a name="1178" /><span class="True">    1178:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1179" /><span class="True">    1179:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1180" /><span class="True">    1180:</span> 
<a name="1181" /><span class="True">    1181:</span> <span class="k">/* Decode a Unicode object unicode and return the result as Python</span>
<a name="1182" /><span class="True">    1182:</span> <span class="k">   object.</span>
<a name="1183" /><span class="True">    1183:</span> <span class="k"></span>
<a name="1184" /><span class="True">    1184:</span> <span class="k">   This API is DEPRECATED. The only supported standard encoding is rot13.</span>
<a name="1185" /><span class="True">    1185:</span> <span class="k">   Use PyCodec_Decode() to decode with rot13 and non-standard codecs</span>
<a name="1186" /><span class="True">    1186:</span> <span class="k">   that decode from str. */</span>
<a name="1187" /><span class="True">    1187:</span> 
<a name="1188" /><span class="True">    1188:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsDecodedObject</span><span class="f">(</span>
<a name="1189" /><span class="True">    1189:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>          <span class="k">/* Unicode object */</span>
<a name="1190" /><span class="True">    1190:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">encoding</span><span class="f">,</span>       <span class="k">/* encoding */</span>
<a name="1191" /><span class="True">    1191:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1192" /><span class="True">    1192:</span>     <span class="f">)</span> <a href="macros_ref.html#_UHlfREVQUkVDQVRFRF8w"><span class="b">Py_DEPRECATED</span></a><span class="f">(</span><span class="c">3.6</span><span class="f">)</span><span class="f">;</span>
<a name="1193" /><span class="True">    1193:</span> 
<a name="1194" /><span class="True">    1194:</span> <span class="k">/* Decode a Unicode object unicode and return the result as Unicode</span>
<a name="1195" /><span class="True">    1195:</span> <span class="k">   object.</span>
<a name="1196" /><span class="True">    1196:</span> <span class="k"></span>
<a name="1197" /><span class="True">    1197:</span> <span class="k">   This API is DEPRECATED. The only supported standard encoding is rot13.</span>
<a name="1198" /><span class="True">    1198:</span> <span class="k">   Use PyCodec_Decode() to decode with rot13 and non-standard codecs</span>
<a name="1199" /><span class="True">    1199:</span> <span class="k">   that decode from str to str. */</span>
<a name="1200" /><span class="True">    1200:</span> 
<a name="1201" /><span class="True">    1201:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsDecodedUnicode</span><span class="f">(</span>
<a name="1202" /><span class="True">    1202:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>          <span class="k">/* Unicode object */</span>
<a name="1203" /><span class="True">    1203:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">encoding</span><span class="f">,</span>       <span class="k">/* encoding */</span>
<a name="1204" /><span class="True">    1204:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1205" /><span class="True">    1205:</span>     <span class="f">)</span> <a href="macros_ref.html#_UHlfREVQUkVDQVRFRF8w"><span class="b">Py_DEPRECATED</span></a><span class="f">(</span><span class="c">3.6</span><span class="f">)</span><span class="f">;</span>
<a name="1206" /><span class="True">    1206:</span> 
<a name="1207" /><span class="True">    1207:</span> <span class="k">/* Encodes a Py_UNICODE buffer of the given size and returns a</span>
<a name="1208" /><span class="True">    1208:</span> <span class="k">   Python string object. */</span>
<a name="1209" /><span class="True">    1209:</span> 
<a name="1210" /><span class="True">    1210:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1211" /><span class="True">    1211:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_Encode</span><span class="f">(</span>
<a name="1212" /><span class="True">    1212:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s</span><span class="f">,</span>        <span class="k">/* Unicode char buffer */</span>
<a name="1213" /><span class="True">    1213:</span>     <span class="b">Py_ssize_t</span> <span class="b">size</span><span class="f">,</span>            <span class="k">/* number of Py_UNICODE chars to encode */</span>
<a name="1214" /><span class="True">    1214:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">encoding</span><span class="f">,</span>       <span class="k">/* encoding */</span>
<a name="1215" /><span class="True">    1215:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1216" /><span class="True">    1216:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1217" /><span class="True">    1217:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1218" /><span class="True">    1218:</span> 
<a name="1219" /><span class="True">    1219:</span> <span class="k">/* Encodes a Unicode object and returns the result as Python</span>
<a name="1220" /><span class="True">    1220:</span> <span class="k">   object.</span>
<a name="1221" /><span class="True">    1221:</span> <span class="k"></span>
<a name="1222" /><span class="True">    1222:</span> <span class="k">   This API is DEPRECATED.  It is superceeded by PyUnicode_AsEncodedString()</span>
<a name="1223" /><span class="True">    1223:</span> <span class="k">   since all standard encodings (except rot13) encode str to bytes.</span>
<a name="1224" /><span class="True">    1224:</span> <span class="k">   Use PyCodec_Encode() for encoding with rot13 and non-standard codecs</span>
<a name="1225" /><span class="True">    1225:</span> <span class="k">   that encode form str to non-bytes. */</span>
<a name="1226" /><span class="True">    1226:</span> 
<a name="1227" /><span class="True">    1227:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsEncodedObject</span><span class="f">(</span>
<a name="1228" /><span class="True">    1228:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>          <span class="k">/* Unicode object */</span>
<a name="1229" /><span class="True">    1229:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">encoding</span><span class="f">,</span>       <span class="k">/* encoding */</span>
<a name="1230" /><span class="True">    1230:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1231" /><span class="True">    1231:</span>     <span class="f">)</span> <a href="macros_ref.html#_UHlfREVQUkVDQVRFRF8w"><span class="b">Py_DEPRECATED</span></a><span class="f">(</span><span class="c">3.6</span><span class="f">)</span><span class="f">;</span>
<a name="1232" /><span class="True">    1232:</span> 
<a name="1233" /><span class="True">    1233:</span> <span class="k">/* Encodes a Unicode object and returns the result as Python string</span>
<a name="1234" /><span class="True">    1234:</span> <span class="k">   object. */</span>
<a name="1235" /><span class="True">    1235:</span> 
<a name="1236" /><span class="True">    1236:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsEncodedString</span><span class="f">(</span>
<a name="1237" /><span class="True">    1237:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>          <span class="k">/* Unicode object */</span>
<a name="1238" /><span class="True">    1238:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">encoding</span><span class="f">,</span>       <span class="k">/* encoding */</span>
<a name="1239" /><span class="True">    1239:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1240" /><span class="True">    1240:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1241" /><span class="True">    1241:</span> 
<a name="1242" /><span class="True">    1242:</span> <span class="k">/* Encodes a Unicode object and returns the result as Unicode</span>
<a name="1243" /><span class="True">    1243:</span> <span class="k">   object.</span>
<a name="1244" /><span class="True">    1244:</span> <span class="k"></span>
<a name="1245" /><span class="True">    1245:</span> <span class="k">   This API is DEPRECATED.  The only supported standard encodings is rot13.</span>
<a name="1246" /><span class="True">    1246:</span> <span class="k">   Use PyCodec_Encode() to encode with rot13 and non-standard codecs</span>
<a name="1247" /><span class="True">    1247:</span> <span class="k">   that encode from str to str. */</span>
<a name="1248" /><span class="True">    1248:</span> 
<a name="1249" /><span class="True">    1249:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsEncodedUnicode</span><span class="f">(</span>
<a name="1250" /><span class="True">    1250:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>          <span class="k">/* Unicode object */</span>
<a name="1251" /><span class="True">    1251:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">encoding</span><span class="f">,</span>       <span class="k">/* encoding */</span>
<a name="1252" /><span class="True">    1252:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1253" /><span class="True">    1253:</span>     <span class="f">)</span> <a href="macros_ref.html#_UHlfREVQUkVDQVRFRF8w"><span class="b">Py_DEPRECATED</span></a><span class="f">(</span><span class="c">3.6</span><span class="f">)</span><span class="f">;</span>
<a name="1254" /><span class="True">    1254:</span> 
<a name="1255" /><span class="True">    1255:</span> <span class="k">/* Build an encoding map. */</span>
<a name="1256" /><span class="True">    1256:</span> 
<a name="1257" /><span class="True">    1257:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_BuildEncodingMap</span><span class="f">(</span>
<a name="1258" /><span class="True">    1258:</span>     <span class="b">PyObject</span><span class="f">*</span> <span class="b">string</span>            <span class="k">/* 256 character map */</span>
<a name="1259" /><span class="True">    1259:</span>    <span class="f">)</span><span class="f">;</span>
<a name="1260" /><span class="True">    1260:</span> 
<a name="1261" /><span class="True">    1261:</span> <span class="k">/* --- UTF-7 Codecs ------------------------------------------------------- */</span>
<a name="1262" /><span class="True">    1262:</span> 
<a name="1263" /><span class="True">    1263:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeUTF7</span><span class="f">(</span>
<a name="1264" /><span class="True">    1264:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* UTF-7 encoded string */</span>
<a name="1265" /><span class="True">    1265:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1266" /><span class="True">    1266:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1267" /><span class="True">    1267:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1268" /><span class="True">    1268:</span> 
<a name="1269" /><span class="True">    1269:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeUTF7Stateful</span><span class="f">(</span>
<a name="1270" /><span class="True">    1270:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* UTF-7 encoded string */</span>
<a name="1271" /><span class="True">    1271:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1272" /><span class="True">    1272:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">,</span>         <span class="k">/* error handling */</span>
<a name="1273" /><span class="True">    1273:</span>     <span class="b">Py_ssize_t</span> <span class="f">*</span><span class="b">consumed</span>        <span class="k">/* bytes consumed */</span>
<a name="1274" /><span class="True">    1274:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1275" /><span class="True">    1275:</span> 
<a name="1276" /><span class="True">    1276:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1277" /><span class="True">    1277:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_EncodeUTF7</span><span class="f">(</span>
<a name="1278" /><span class="True">    1278:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">data</span><span class="f">,</span>     <span class="k">/* Unicode char buffer */</span>
<a name="1279" /><span class="True">    1279:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* number of Py_UNICODE chars to encode */</span>
<a name="1280" /><span class="True">    1280:</span>     <span class="m">int</span> <span class="b">base64SetO</span><span class="f">,</span>             <span class="k">/* Encode RFC2152 Set O characters in base64 */</span>
<a name="1281" /><span class="True">    1281:</span>     <span class="m">int</span> <span class="b">base64WhiteSpace</span><span class="f">,</span>       <span class="k">/* Encode whitespace (sp, ht, nl, cr) in base64 */</span>
<a name="1282" /><span class="True">    1282:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1283" /><span class="True">    1283:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1284" /><span class="True">    1284:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_EncodeUTF7</span><span class="f">(</span>
<a name="1285" /><span class="True">    1285:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>          <span class="k">/* Unicode object */</span>
<a name="1286" /><span class="True">    1286:</span>     <span class="m">int</span> <span class="b">base64SetO</span><span class="f">,</span>             <span class="k">/* Encode RFC2152 Set O characters in base64 */</span>
<a name="1287" /><span class="True">    1287:</span>     <span class="m">int</span> <span class="b">base64WhiteSpace</span><span class="f">,</span>       <span class="k">/* Encode whitespace (sp, ht, nl, cr) in base64 */</span>
<a name="1288" /><span class="True">    1288:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1289" /><span class="True">    1289:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1290" /><span class="True">    1290:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1291" /><span class="True">    1291:</span> 
<a name="1292" /><span class="True">    1292:</span> <span class="k">/* --- UTF-8 Codecs ------------------------------------------------------- */</span>
<a name="1293" /><span class="True">    1293:</span> 
<a name="1294" /><span class="True">    1294:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeUTF8</span><span class="f">(</span>
<a name="1295" /><span class="True">    1295:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* UTF-8 encoded string */</span>
<a name="1296" /><span class="True">    1296:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1297" /><span class="True">    1297:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1298" /><span class="True">    1298:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1299" /><span class="True">    1299:</span> 
<a name="1300" /><span class="True">    1300:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeUTF8Stateful</span><span class="f">(</span>
<a name="1301" /><span class="True">    1301:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* UTF-8 encoded string */</span>
<a name="1302" /><span class="True">    1302:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1303" /><span class="True">    1303:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">,</span>         <span class="k">/* error handling */</span>
<a name="1304" /><span class="True">    1304:</span>     <span class="b">Py_ssize_t</span> <span class="f">*</span><span class="b">consumed</span>        <span class="k">/* bytes consumed */</span>
<a name="1305" /><span class="True">    1305:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1306" /><span class="True">    1306:</span> 
<a name="1307" /><span class="True">    1307:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsUTF8String</span><span class="f">(</span>
<a name="1308" /><span class="True">    1308:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>           <span class="k">/* Unicode object */</span>
<a name="1309" /><span class="True">    1309:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1310" /><span class="True">    1310:</span> 
<a name="1311" /><span class="True">    1311:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1312" /><span class="True">    1312:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_AsUTF8String</span><span class="f">(</span>
<a name="1313" /><span class="True">    1313:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>
<a name="1314" /><span class="True">    1314:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">)</span><span class="f">;</span>
<a name="1315" /><span class="True">    1315:</span> 
<a name="1316" /><span class="True">    1316:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_EncodeUTF8</span><span class="f">(</span>
<a name="1317" /><span class="True">    1317:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">data</span><span class="f">,</span>     <span class="k">/* Unicode char buffer */</span>
<a name="1318" /><span class="True">    1318:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* number of Py_UNICODE chars to encode */</span>
<a name="1319" /><span class="True">    1319:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1320" /><span class="True">    1320:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1321" /><span class="True">    1321:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1322" /><span class="True">    1322:</span> 
<a name="1323" /><span class="True">    1323:</span> <span class="k">/* --- UTF-32 Codecs ------------------------------------------------------ */</span>
<a name="1324" /><span class="True">    1324:</span> 
<a name="1325" /><span class="True">    1325:</span> <span class="k">/* Decodes length bytes from a UTF-32 encoded buffer string and returns</span>
<a name="1326" /><span class="True">    1326:</span> <span class="k">   the corresponding Unicode object.</span>
<a name="1327" /><span class="True">    1327:</span> <span class="k"></span>
<a name="1328" /><span class="True">    1328:</span> <span class="k">   errors (if non-NULL) defines the error handling. It defaults</span>
<a name="1329" /><span class="True">    1329:</span> <span class="k">   to &quot;strict&quot;.</span>
<a name="1330" /><span class="True">    1330:</span> <span class="k"></span>
<a name="1331" /><span class="True">    1331:</span> <span class="k">   If byteorder is non-NULL, the decoder starts decoding using the</span>
<a name="1332" /><span class="True">    1332:</span> <span class="k">   given byte order:</span>
<a name="1333" /><span class="True">    1333:</span> <span class="k"></span>
<a name="1334" /><span class="True">    1334:</span> <span class="k">    *byteorder == -1: little endian</span>
<a name="1335" /><span class="True">    1335:</span> <span class="k">    *byteorder == 0:  native order</span>
<a name="1336" /><span class="True">    1336:</span> <span class="k">    *byteorder == 1:  big endian</span>
<a name="1337" /><span class="True">    1337:</span> <span class="k"></span>
<a name="1338" /><span class="True">    1338:</span> <span class="k">   In native mode, the first four bytes of the stream are checked for a</span>
<a name="1339" /><span class="True">    1339:</span> <span class="k">   BOM mark. If found, the BOM mark is analysed, the byte order</span>
<a name="1340" /><span class="True">    1340:</span> <span class="k">   adjusted and the BOM skipped.  In the other modes, no BOM mark</span>
<a name="1341" /><span class="True">    1341:</span> <span class="k">   interpretation is done. After completion, *byteorder is set to the</span>
<a name="1342" /><span class="True">    1342:</span> <span class="k">   current byte order at the end of input data.</span>
<a name="1343" /><span class="True">    1343:</span> <span class="k"></span>
<a name="1344" /><span class="True">    1344:</span> <span class="k">   If byteorder is NULL, the codec starts in native order mode.</span>
<a name="1345" /><span class="True">    1345:</span> <span class="k"></span>
<a name="1346" /><span class="True">    1346:</span> <span class="k">*/</span>
<a name="1347" /><span class="True">    1347:</span> 
<a name="1348" /><span class="True">    1348:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeUTF32</span><span class="f">(</span>
<a name="1349" /><span class="True">    1349:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* UTF-32 encoded string */</span>
<a name="1350" /><span class="True">    1350:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1351" /><span class="True">    1351:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">,</span>         <span class="k">/* error handling */</span>
<a name="1352" /><span class="True">    1352:</span>     <span class="m">int</span> <span class="f">*</span><span class="b">byteorder</span>              <span class="k">/* pointer to byteorder to use</span>
<a name="1353" /><span class="True">    1353:</span> <span class="k">                                   0=native;-1=LE,1=BE; updated on</span>
<a name="1354" /><span class="True">    1354:</span> <span class="k">                                   exit */</span>
<a name="1355" /><span class="True">    1355:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1356" /><span class="True">    1356:</span> 
<a name="1357" /><span class="True">    1357:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeUTF32Stateful</span><span class="f">(</span>
<a name="1358" /><span class="True">    1358:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* UTF-32 encoded string */</span>
<a name="1359" /><span class="True">    1359:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1360" /><span class="True">    1360:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">,</span>         <span class="k">/* error handling */</span>
<a name="1361" /><span class="True">    1361:</span>     <span class="m">int</span> <span class="f">*</span><span class="b">byteorder</span><span class="f">,</span>             <span class="k">/* pointer to byteorder to use</span>
<a name="1362" /><span class="True">    1362:</span> <span class="k">                                   0=native;-1=LE,1=BE; updated on</span>
<a name="1363" /><span class="True">    1363:</span> <span class="k">                                   exit */</span>
<a name="1364" /><span class="True">    1364:</span>     <span class="b">Py_ssize_t</span> <span class="f">*</span><span class="b">consumed</span>        <span class="k">/* bytes consumed */</span>
<a name="1365" /><span class="True">    1365:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1366" /><span class="True">    1366:</span> 
<a name="1367" /><span class="True">    1367:</span> <span class="k">/* Returns a Python string using the UTF-32 encoding in native byte</span>
<a name="1368" /><span class="True">    1368:</span> <span class="k">   order. The string always starts with a BOM mark.  */</span>
<a name="1369" /><span class="True">    1369:</span> 
<a name="1370" /><span class="True">    1370:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsUTF32String</span><span class="f">(</span>
<a name="1371" /><span class="True">    1371:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>           <span class="k">/* Unicode object */</span>
<a name="1372" /><span class="True">    1372:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1373" /><span class="True">    1373:</span> 
<a name="1374" /><span class="True">    1374:</span> <span class="k">/* Returns a Python string object holding the UTF-32 encoded value of</span>
<a name="1375" /><span class="True">    1375:</span> <span class="k">   the Unicode data.</span>
<a name="1376" /><span class="True">    1376:</span> <span class="k"></span>
<a name="1377" /><span class="True">    1377:</span> <span class="k">   If byteorder is not 0, output is written according to the following</span>
<a name="1378" /><span class="True">    1378:</span> <span class="k">   byte order:</span>
<a name="1379" /><span class="True">    1379:</span> <span class="k"></span>
<a name="1380" /><span class="True">    1380:</span> <span class="k">   byteorder == -1: little endian</span>
<a name="1381" /><span class="True">    1381:</span> <span class="k">   byteorder == 0:  native byte order (writes a BOM mark)</span>
<a name="1382" /><span class="True">    1382:</span> <span class="k">   byteorder == 1:  big endian</span>
<a name="1383" /><span class="True">    1383:</span> <span class="k"></span>
<a name="1384" /><span class="True">    1384:</span> <span class="k">   If byteorder is 0, the output string will always start with the</span>
<a name="1385" /><span class="True">    1385:</span> <span class="k">   Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is</span>
<a name="1386" /><span class="True">    1386:</span> <span class="k">   prepended.</span>
<a name="1387" /><span class="True">    1387:</span> <span class="k"></span>
<a name="1388" /><span class="True">    1388:</span> <span class="k">*/</span>
<a name="1389" /><span class="True">    1389:</span> 
<a name="1390" /><span class="True">    1390:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1391" /><span class="True">    1391:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_EncodeUTF32</span><span class="f">(</span>
<a name="1392" /><span class="True">    1392:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">data</span><span class="f">,</span>     <span class="k">/* Unicode char buffer */</span>
<a name="1393" /><span class="True">    1393:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* number of Py_UNICODE chars to encode */</span>
<a name="1394" /><span class="True">    1394:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">,</span>         <span class="k">/* error handling */</span>
<a name="1395" /><span class="True">    1395:</span>     <span class="m">int</span> <span class="b">byteorder</span>               <span class="k">/* byteorder to use 0=BOM+native;-1=LE,1=BE */</span>
<a name="1396" /><span class="True">    1396:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1397" /><span class="True">    1397:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_EncodeUTF32</span><span class="f">(</span>
<a name="1398" /><span class="True">    1398:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">object</span><span class="f">,</span>           <span class="k">/* Unicode object */</span>
<a name="1399" /><span class="True">    1399:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">,</span>         <span class="k">/* error handling */</span>
<a name="1400" /><span class="True">    1400:</span>     <span class="m">int</span> <span class="b">byteorder</span>               <span class="k">/* byteorder to use 0=BOM+native;-1=LE,1=BE */</span>
<a name="1401" /><span class="True">    1401:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1402" /><span class="True">    1402:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1403" /><span class="True">    1403:</span> 
<a name="1404" /><span class="True">    1404:</span> <span class="k">/* --- UTF-16 Codecs ------------------------------------------------------ */</span>
<a name="1405" /><span class="True">    1405:</span> 
<a name="1406" /><span class="True">    1406:</span> <span class="k">/* Decodes length bytes from a UTF-16 encoded buffer string and returns</span>
<a name="1407" /><span class="True">    1407:</span> <span class="k">   the corresponding Unicode object.</span>
<a name="1408" /><span class="True">    1408:</span> <span class="k"></span>
<a name="1409" /><span class="True">    1409:</span> <span class="k">   errors (if non-NULL) defines the error handling. It defaults</span>
<a name="1410" /><span class="True">    1410:</span> <span class="k">   to &quot;strict&quot;.</span>
<a name="1411" /><span class="True">    1411:</span> <span class="k"></span>
<a name="1412" /><span class="True">    1412:</span> <span class="k">   If byteorder is non-NULL, the decoder starts decoding using the</span>
<a name="1413" /><span class="True">    1413:</span> <span class="k">   given byte order:</span>
<a name="1414" /><span class="True">    1414:</span> <span class="k"></span>
<a name="1415" /><span class="True">    1415:</span> <span class="k">    *byteorder == -1: little endian</span>
<a name="1416" /><span class="True">    1416:</span> <span class="k">    *byteorder == 0:  native order</span>
<a name="1417" /><span class="True">    1417:</span> <span class="k">    *byteorder == 1:  big endian</span>
<a name="1418" /><span class="True">    1418:</span> <span class="k"></span>
<a name="1419" /><span class="True">    1419:</span> <span class="k">   In native mode, the first two bytes of the stream are checked for a</span>
<a name="1420" /><span class="True">    1420:</span> <span class="k">   BOM mark. If found, the BOM mark is analysed, the byte order</span>
<a name="1421" /><span class="True">    1421:</span> <span class="k">   adjusted and the BOM skipped.  In the other modes, no BOM mark</span>
<a name="1422" /><span class="True">    1422:</span> <span class="k">   interpretation is done. After completion, *byteorder is set to the</span>
<a name="1423" /><span class="True">    1423:</span> <span class="k">   current byte order at the end of input data.</span>
<a name="1424" /><span class="True">    1424:</span> <span class="k"></span>
<a name="1425" /><span class="True">    1425:</span> <span class="k">   If byteorder is NULL, the codec starts in native order mode.</span>
<a name="1426" /><span class="True">    1426:</span> <span class="k"></span>
<a name="1427" /><span class="True">    1427:</span> <span class="k">*/</span>
<a name="1428" /><span class="True">    1428:</span> 
<a name="1429" /><span class="True">    1429:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeUTF16</span><span class="f">(</span>
<a name="1430" /><span class="True">    1430:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* UTF-16 encoded string */</span>
<a name="1431" /><span class="True">    1431:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1432" /><span class="True">    1432:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">,</span>         <span class="k">/* error handling */</span>
<a name="1433" /><span class="True">    1433:</span>     <span class="m">int</span> <span class="f">*</span><span class="b">byteorder</span>              <span class="k">/* pointer to byteorder to use</span>
<a name="1434" /><span class="True">    1434:</span> <span class="k">                                   0=native;-1=LE,1=BE; updated on</span>
<a name="1435" /><span class="True">    1435:</span> <span class="k">                                   exit */</span>
<a name="1436" /><span class="True">    1436:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1437" /><span class="True">    1437:</span> 
<a name="1438" /><span class="True">    1438:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeUTF16Stateful</span><span class="f">(</span>
<a name="1439" /><span class="True">    1439:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* UTF-16 encoded string */</span>
<a name="1440" /><span class="True">    1440:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1441" /><span class="True">    1441:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">,</span>         <span class="k">/* error handling */</span>
<a name="1442" /><span class="True">    1442:</span>     <span class="m">int</span> <span class="f">*</span><span class="b">byteorder</span><span class="f">,</span>             <span class="k">/* pointer to byteorder to use</span>
<a name="1443" /><span class="True">    1443:</span> <span class="k">                                   0=native;-1=LE,1=BE; updated on</span>
<a name="1444" /><span class="True">    1444:</span> <span class="k">                                   exit */</span>
<a name="1445" /><span class="True">    1445:</span>     <span class="b">Py_ssize_t</span> <span class="f">*</span><span class="b">consumed</span>        <span class="k">/* bytes consumed */</span>
<a name="1446" /><span class="True">    1446:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1447" /><span class="True">    1447:</span> 
<a name="1448" /><span class="True">    1448:</span> <span class="k">/* Returns a Python string using the UTF-16 encoding in native byte</span>
<a name="1449" /><span class="True">    1449:</span> <span class="k">   order. The string always starts with a BOM mark.  */</span>
<a name="1450" /><span class="True">    1450:</span> 
<a name="1451" /><span class="True">    1451:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsUTF16String</span><span class="f">(</span>
<a name="1452" /><span class="True">    1452:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>           <span class="k">/* Unicode object */</span>
<a name="1453" /><span class="True">    1453:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1454" /><span class="True">    1454:</span> 
<a name="1455" /><span class="True">    1455:</span> <span class="k">/* Returns a Python string object holding the UTF-16 encoded value of</span>
<a name="1456" /><span class="True">    1456:</span> <span class="k">   the Unicode data.</span>
<a name="1457" /><span class="True">    1457:</span> <span class="k"></span>
<a name="1458" /><span class="True">    1458:</span> <span class="k">   If byteorder is not 0, output is written according to the following</span>
<a name="1459" /><span class="True">    1459:</span> <span class="k">   byte order:</span>
<a name="1460" /><span class="True">    1460:</span> <span class="k"></span>
<a name="1461" /><span class="True">    1461:</span> <span class="k">   byteorder == -1: little endian</span>
<a name="1462" /><span class="True">    1462:</span> <span class="k">   byteorder == 0:  native byte order (writes a BOM mark)</span>
<a name="1463" /><span class="True">    1463:</span> <span class="k">   byteorder == 1:  big endian</span>
<a name="1464" /><span class="True">    1464:</span> <span class="k"></span>
<a name="1465" /><span class="True">    1465:</span> <span class="k">   If byteorder is 0, the output string will always start with the</span>
<a name="1466" /><span class="True">    1466:</span> <span class="k">   Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is</span>
<a name="1467" /><span class="True">    1467:</span> <span class="k">   prepended.</span>
<a name="1468" /><span class="True">    1468:</span> <span class="k"></span>
<a name="1469" /><span class="True">    1469:</span> <span class="k">   Note that Py_UNICODE data is being interpreted as UTF-16 reduced to</span>
<a name="1470" /><span class="True">    1470:</span> <span class="k">   UCS-2. This trick makes it possible to add full UTF-16 capabilities</span>
<a name="1471" /><span class="True">    1471:</span> <span class="k">   at a later point without compromising the APIs.</span>
<a name="1472" /><span class="True">    1472:</span> <span class="k"></span>
<a name="1473" /><span class="True">    1473:</span> <span class="k">*/</span>
<a name="1474" /><span class="True">    1474:</span> 
<a name="1475" /><span class="True">    1475:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1476" /><span class="True">    1476:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_EncodeUTF16</span><span class="f">(</span>
<a name="1477" /><span class="True">    1477:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">data</span><span class="f">,</span>     <span class="k">/* Unicode char buffer */</span>
<a name="1478" /><span class="True">    1478:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* number of Py_UNICODE chars to encode */</span>
<a name="1479" /><span class="True">    1479:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">,</span>         <span class="k">/* error handling */</span>
<a name="1480" /><span class="True">    1480:</span>     <span class="m">int</span> <span class="b">byteorder</span>               <span class="k">/* byteorder to use 0=BOM+native;-1=LE,1=BE */</span>
<a name="1481" /><span class="True">    1481:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1482" /><span class="True">    1482:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_EncodeUTF16</span><span class="f">(</span>
<a name="1483" /><span class="True">    1483:</span>     <span class="b">PyObject</span><span class="f">*</span> <span class="b">unicode</span><span class="f">,</span>          <span class="k">/* Unicode object */</span>
<a name="1484" /><span class="True">    1484:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">,</span>         <span class="k">/* error handling */</span>
<a name="1485" /><span class="True">    1485:</span>     <span class="m">int</span> <span class="b">byteorder</span>               <span class="k">/* byteorder to use 0=BOM+native;-1=LE,1=BE */</span>
<a name="1486" /><span class="True">    1486:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1487" /><span class="True">    1487:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1488" /><span class="True">    1488:</span> 
<a name="1489" /><span class="True">    1489:</span> <span class="k">/* --- Unicode-Escape Codecs ---------------------------------------------- */</span>
<a name="1490" /><span class="True">    1490:</span> 
<a name="1491" /><span class="True">    1491:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeUnicodeEscape</span><span class="f">(</span>
<a name="1492" /><span class="True">    1492:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* Unicode-Escape encoded string */</span>
<a name="1493" /><span class="True">    1493:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1494" /><span class="True">    1494:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1495" /><span class="True">    1495:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1496" /><span class="True">    1496:</span> 
<a name="1497" /><span class="True">    1497:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1498" /><span class="True">    1498:</span> <span class="k">/* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape</span>
<a name="1499" /><span class="True">    1499:</span> <span class="k">   chars. */</span>
<a name="1500" /><span class="True">    1500:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_DecodeUnicodeEscape</span><span class="f">(</span>
<a name="1501" /><span class="True">    1501:</span>         <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>     <span class="k">/* Unicode-Escape encoded string */</span>
<a name="1502" /><span class="True">    1502:</span>         <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>      <span class="k">/* size of string */</span>
<a name="1503" /><span class="True">    1503:</span>         <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">,</span>     <span class="k">/* error handling */</span>
<a name="1504" /><span class="True">    1504:</span>         <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="f">*</span><span class="b">first_invalid_escape</span>  <span class="k">/* on return, points to first</span>
<a name="1505" /><span class="True">    1505:</span> <span class="k">                                              invalid escaped char in</span>
<a name="1506" /><span class="True">    1506:</span> <span class="k">                                              string. */</span>
<a name="1507" /><span class="True">    1507:</span> <span class="f">)</span><span class="f">;</span>
<a name="1508" /><span class="True">    1508:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1509" /><span class="True">    1509:</span> 
<a name="1510" /><span class="True">    1510:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsUnicodeEscapeString</span><span class="f">(</span>
<a name="1511" /><span class="True">    1511:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>           <span class="k">/* Unicode object */</span>
<a name="1512" /><span class="True">    1512:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1513" /><span class="True">    1513:</span> 
<a name="1514" /><span class="True">    1514:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1515" /><span class="True">    1515:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_EncodeUnicodeEscape</span><span class="f">(</span>
<a name="1516" /><span class="True">    1516:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">data</span><span class="f">,</span>     <span class="k">/* Unicode char buffer */</span>
<a name="1517" /><span class="True">    1517:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span>           <span class="k">/* Number of Py_UNICODE chars to encode */</span>
<a name="1518" /><span class="True">    1518:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1519" /><span class="True">    1519:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1520" /><span class="True">    1520:</span> 
<a name="1521" /><span class="True">    1521:</span> <span class="k">/* --- Raw-Unicode-Escape Codecs ------------------------------------------ */</span>
<a name="1522" /><span class="True">    1522:</span> 
<a name="1523" /><span class="True">    1523:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeRawUnicodeEscape</span><span class="f">(</span>
<a name="1524" /><span class="True">    1524:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* Raw-Unicode-Escape encoded string */</span>
<a name="1525" /><span class="True">    1525:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1526" /><span class="True">    1526:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1527" /><span class="True">    1527:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1528" /><span class="True">    1528:</span> 
<a name="1529" /><span class="True">    1529:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsRawUnicodeEscapeString</span><span class="f">(</span>
<a name="1530" /><span class="True">    1530:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>           <span class="k">/* Unicode object */</span>
<a name="1531" /><span class="True">    1531:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1532" /><span class="True">    1532:</span> 
<a name="1533" /><span class="True">    1533:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1534" /><span class="True">    1534:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_EncodeRawUnicodeEscape</span><span class="f">(</span>
<a name="1535" /><span class="True">    1535:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">data</span><span class="f">,</span>     <span class="k">/* Unicode char buffer */</span>
<a name="1536" /><span class="True">    1536:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span>           <span class="k">/* Number of Py_UNICODE chars to encode */</span>
<a name="1537" /><span class="True">    1537:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1538" /><span class="True">    1538:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1539" /><span class="True">    1539:</span> 
<a name="1540" /><span class="True">    1540:</span> <span class="k">/* --- Unicode Internal Codec ---------------------------------------------</span>
<a name="1541" /><span class="True">    1541:</span> <span class="k"></span>
<a name="1542" /><span class="True">    1542:</span> <span class="k">    Only for internal use in _codecsmodule.c */</span>
<a name="1543" /><span class="True">    1543:</span> 
<a name="1544" /><span class="True">    1544:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1545" /><span class="True">    1545:</span> <span class="b">PyObject</span> <span class="f">*</span><span class="b">_PyUnicode_DecodeUnicodeInternal</span><span class="f">(</span>
<a name="1546" /><span class="True">    1546:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>
<a name="1547" /><span class="True">    1547:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>
<a name="1548" /><span class="True">    1548:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>
<a name="1549" /><span class="True">    1549:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1550" /><span class="True">    1550:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1551" /><span class="True">    1551:</span> 
<a name="1552" /><span class="True">    1552:</span> <span class="k">/* --- Latin-1 Codecs -----------------------------------------------------</span>
<a name="1553" /><span class="True">    1553:</span> <span class="k"></span>
<a name="1554" /><span class="True">    1554:</span> <span class="k">   Note: Latin-1 corresponds to the first 256 Unicode ordinals.</span>
<a name="1555" /><span class="True">    1555:</span> <span class="k"></span>
<a name="1556" /><span class="True">    1556:</span> <span class="k">*/</span>
<a name="1557" /><span class="True">    1557:</span> 
<a name="1558" /><span class="True">    1558:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeLatin1</span><span class="f">(</span>
<a name="1559" /><span class="True">    1559:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* Latin-1 encoded string */</span>
<a name="1560" /><span class="True">    1560:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1561" /><span class="True">    1561:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1562" /><span class="True">    1562:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1563" /><span class="True">    1563:</span> 
<a name="1564" /><span class="True">    1564:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsLatin1String</span><span class="f">(</span>
<a name="1565" /><span class="True">    1565:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>           <span class="k">/* Unicode object */</span>
<a name="1566" /><span class="True">    1566:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1567" /><span class="True">    1567:</span> 
<a name="1568" /><span class="True">    1568:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1569" /><span class="True">    1569:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_AsLatin1String</span><span class="f">(</span>
<a name="1570" /><span class="True">    1570:</span>     <span class="b">PyObject</span><span class="f">*</span> <span class="b">unicode</span><span class="f">,</span>
<a name="1571" /><span class="True">    1571:</span>     <span class="m">const</span> <span class="m">char</span><span class="f">*</span> <span class="b">errors</span><span class="f">)</span><span class="f">;</span>
<a name="1572" /><span class="True">    1572:</span> 
<a name="1573" /><span class="True">    1573:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_EncodeLatin1</span><span class="f">(</span>
<a name="1574" /><span class="True">    1574:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">data</span><span class="f">,</span>     <span class="k">/* Unicode char buffer */</span>
<a name="1575" /><span class="True">    1575:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* Number of Py_UNICODE chars to encode */</span>
<a name="1576" /><span class="True">    1576:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1577" /><span class="True">    1577:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1578" /><span class="True">    1578:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1579" /><span class="True">    1579:</span> 
<a name="1580" /><span class="True">    1580:</span> <span class="k">/* --- ASCII Codecs -------------------------------------------------------</span>
<a name="1581" /><span class="True">    1581:</span> <span class="k"></span>
<a name="1582" /><span class="True">    1582:</span> <span class="k">   Only 7-bit ASCII data is excepted. All other codes generate errors.</span>
<a name="1583" /><span class="True">    1583:</span> <span class="k"></span>
<a name="1584" /><span class="True">    1584:</span> <span class="k">*/</span>
<a name="1585" /><span class="True">    1585:</span> 
<a name="1586" /><span class="True">    1586:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeASCII</span><span class="f">(</span>
<a name="1587" /><span class="True">    1587:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* ASCII encoded string */</span>
<a name="1588" /><span class="True">    1588:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1589" /><span class="True">    1589:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1590" /><span class="True">    1590:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1591" /><span class="True">    1591:</span> 
<a name="1592" /><span class="True">    1592:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsASCIIString</span><span class="f">(</span>
<a name="1593" /><span class="True">    1593:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>           <span class="k">/* Unicode object */</span>
<a name="1594" /><span class="True">    1594:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1595" /><span class="True">    1595:</span> 
<a name="1596" /><span class="True">    1596:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1597" /><span class="True">    1597:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_AsASCIIString</span><span class="f">(</span>
<a name="1598" /><span class="True">    1598:</span>     <span class="b">PyObject</span><span class="f">*</span> <span class="b">unicode</span><span class="f">,</span>
<a name="1599" /><span class="True">    1599:</span>     <span class="m">const</span> <span class="m">char</span><span class="f">*</span> <span class="b">errors</span><span class="f">)</span><span class="f">;</span>
<a name="1600" /><span class="True">    1600:</span> 
<a name="1601" /><span class="True">    1601:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_EncodeASCII</span><span class="f">(</span>
<a name="1602" /><span class="True">    1602:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">data</span><span class="f">,</span>     <span class="k">/* Unicode char buffer */</span>
<a name="1603" /><span class="True">    1603:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* Number of Py_UNICODE chars to encode */</span>
<a name="1604" /><span class="True">    1604:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1605" /><span class="True">    1605:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1606" /><span class="True">    1606:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1607" /><span class="True">    1607:</span> 
<a name="1608" /><span class="True">    1608:</span> <span class="k">/* --- Character Map Codecs -----------------------------------------------</span>
<a name="1609" /><span class="True">    1609:</span> <span class="k"></span>
<a name="1610" /><span class="True">    1610:</span> <span class="k">   This codec uses mappings to encode and decode characters.</span>
<a name="1611" /><span class="True">    1611:</span> <span class="k"></span>
<a name="1612" /><span class="True">    1612:</span> <span class="k">   Decoding mappings must map byte ordinals (integers in the range from 0 to</span>
<a name="1613" /><span class="True">    1613:</span> <span class="k">   255) to Unicode strings, integers (which are then interpreted as Unicode</span>
<a name="1614" /><span class="True">    1614:</span> <span class="k">   ordinals) or None.  Unmapped data bytes (ones which cause a LookupError)</span>
<a name="1615" /><span class="True">    1615:</span> <span class="k">   as well as mapped to None, 0xFFFE or &apos;\ufffe&apos; are treated as &quot;undefined</span>
<a name="1616" /><span class="True">    1616:</span> <span class="k">   mapping&quot; and cause an error.</span>
<a name="1617" /><span class="True">    1617:</span> <span class="k"></span>
<a name="1618" /><span class="True">    1618:</span> <span class="k">   Encoding mappings must map Unicode ordinal integers to bytes objects,</span>
<a name="1619" /><span class="True">    1619:</span> <span class="k">   integers in the range from 0 to 255 or None.  Unmapped character</span>
<a name="1620" /><span class="True">    1620:</span> <span class="k">   ordinals (ones which cause a LookupError) as well as mapped to</span>
<a name="1621" /><span class="True">    1621:</span> <span class="k">   None are treated as &quot;undefined mapping&quot; and cause an error.</span>
<a name="1622" /><span class="True">    1622:</span> <span class="k"></span>
<a name="1623" /><span class="True">    1623:</span> <span class="k">*/</span>
<a name="1624" /><span class="True">    1624:</span> 
<a name="1625" /><span class="True">    1625:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeCharmap</span><span class="f">(</span>
<a name="1626" /><span class="True">    1626:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* Encoded string */</span>
<a name="1627" /><span class="True">    1627:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1628" /><span class="True">    1628:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">mapping</span><span class="f">,</span>          <span class="k">/* decoding mapping */</span>
<a name="1629" /><span class="True">    1629:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1630" /><span class="True">    1630:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1631" /><span class="True">    1631:</span> 
<a name="1632" /><span class="True">    1632:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsCharmapString</span><span class="f">(</span>
<a name="1633" /><span class="True">    1633:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>          <span class="k">/* Unicode object */</span>
<a name="1634" /><span class="True">    1634:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">mapping</span>           <span class="k">/* encoding mapping */</span>
<a name="1635" /><span class="True">    1635:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1636" /><span class="True">    1636:</span> 
<a name="1637" /><span class="True">    1637:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1638" /><span class="True">    1638:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_EncodeCharmap</span><span class="f">(</span>
<a name="1639" /><span class="True">    1639:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">data</span><span class="f">,</span>     <span class="k">/* Unicode char buffer */</span>
<a name="1640" /><span class="True">    1640:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* Number of Py_UNICODE chars to encode */</span>
<a name="1641" /><span class="True">    1641:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">mapping</span><span class="f">,</span>          <span class="k">/* encoding mapping */</span>
<a name="1642" /><span class="True">    1642:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1643" /><span class="True">    1643:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1644" /><span class="True">    1644:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_EncodeCharmap</span><span class="f">(</span>
<a name="1645" /><span class="True">    1645:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>          <span class="k">/* Unicode object */</span>
<a name="1646" /><span class="True">    1646:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">mapping</span><span class="f">,</span>          <span class="k">/* encoding mapping */</span>
<a name="1647" /><span class="True">    1647:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1648" /><span class="True">    1648:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1649" /><span class="True">    1649:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1650" /><span class="True">    1650:</span> 
<a name="1651" /><span class="True">    1651:</span> <span class="k">/* Translate a Py_UNICODE buffer of the given length by applying a</span>
<a name="1652" /><span class="True">    1652:</span> <span class="k">   character mapping table to it and return the resulting Unicode</span>
<a name="1653" /><span class="True">    1653:</span> <span class="k">   object.</span>
<a name="1654" /><span class="True">    1654:</span> <span class="k"></span>
<a name="1655" /><span class="True">    1655:</span> <span class="k">   The mapping table must map Unicode ordinal integers to Unicode strings,</span>
<a name="1656" /><span class="True">    1656:</span> <span class="k">   Unicode ordinal integers or None (causing deletion of the character).</span>
<a name="1657" /><span class="True">    1657:</span> <span class="k"></span>
<a name="1658" /><span class="True">    1658:</span> <span class="k">   Mapping tables may be dictionaries or sequences. Unmapped character</span>
<a name="1659" /><span class="True">    1659:</span> <span class="k">   ordinals (ones which cause a LookupError) are left untouched and</span>
<a name="1660" /><span class="True">    1660:</span> <span class="k">   are copied as-is.</span>
<a name="1661" /><span class="True">    1661:</span> <span class="k"></span>
<a name="1662" /><span class="True">    1662:</span> <span class="k">*/</span>
<a name="1663" /><span class="True">    1663:</span> 
<a name="1664" /><span class="True">    1664:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1665" /><span class="True">    1665:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_TranslateCharmap</span><span class="f">(</span>
<a name="1666" /><span class="True">    1666:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">data</span><span class="f">,</span>     <span class="k">/* Unicode char buffer */</span>
<a name="1667" /><span class="True">    1667:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* Number of Py_UNICODE chars to encode */</span>
<a name="1668" /><span class="True">    1668:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">table</span><span class="f">,</span>            <span class="k">/* Translate table */</span>
<a name="1669" /><span class="True">    1669:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1670" /><span class="True">    1670:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1671" /><span class="True">    1671:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1672" /><span class="True">    1672:</span> 
<a name="1673" /><span class="False">    1673:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">MS_WINDOWS</span>
<a name="1674" /><span class="False">    1674:</span> 
<a name="1675" /><span class="False">    1675:</span> <span class="k">/* --- MBCS codecs for Windows -------------------------------------------- */</span>
<a name="1676" /><span class="False">    1676:</span> 
<a name="1677" /><span class="False">    1677:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeMBCS</span><span class="f">(</span>
<a name="1678" /><span class="False">    1678:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* MBCS encoded string */</span>
<a name="1679" /><span class="False">    1679:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1680" /><span class="False">    1680:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1681" /><span class="False">    1681:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1682" /><span class="False">    1682:</span> 
<a name="1683" /><span class="False">    1683:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeMBCSStateful</span><span class="f">(</span>
<a name="1684" /><span class="False">    1684:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* MBCS encoded string */</span>
<a name="1685" /><span class="False">    1685:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1686" /><span class="False">    1686:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">,</span>         <span class="k">/* error handling */</span>
<a name="1687" /><span class="False">    1687:</span>     <span class="b">Py_ssize_t</span> <span class="f">*</span><span class="b">consumed</span>        <span class="k">/* bytes consumed */</span>
<a name="1688" /><span class="False">    1688:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1689" /><span class="False">    1689:</span> 
<a name="1690" /><span class="False">    1690:</span> <span class="f">#</span><span class="n">if</span> <span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">Py_LIMITED_API</span><span class="f">)</span> <span class="f">||</span> <span class="b">Py_LIMITED_API</span><span class="f">+</span><span class="c">0</span> <span class="f">&gt;=</span> <span class="c">0x03030000</span>
<a name="1691" /><span class="False">    1691:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeCodePageStateful</span><span class="f">(</span>
<a name="1692" /><span class="False">    1692:</span>     <span class="m">int</span> <span class="b">code_page</span><span class="f">,</span>              <span class="k">/* code page number */</span>
<a name="1693" /><span class="False">    1693:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">string</span><span class="f">,</span>         <span class="k">/* encoded string */</span>
<a name="1694" /><span class="False">    1694:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* size of string */</span>
<a name="1695" /><span class="False">    1695:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">,</span>         <span class="k">/* error handling */</span>
<a name="1696" /><span class="False">    1696:</span>     <span class="b">Py_ssize_t</span> <span class="f">*</span><span class="b">consumed</span>        <span class="k">/* bytes consumed */</span>
<a name="1697" /><span class="False">    1697:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1698" /><span class="False">    1698:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1699" /><span class="False">    1699:</span> 
<a name="1700" /><span class="False">    1700:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsMBCSString</span><span class="f">(</span>
<a name="1701" /><span class="False">    1701:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>           <span class="k">/* Unicode object */</span>
<a name="1702" /><span class="False">    1702:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1703" /><span class="False">    1703:</span> 
<a name="1704" /><span class="False">    1704:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1705" /><span class="False">    1705:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_EncodeMBCS</span><span class="f">(</span>
<a name="1706" /><span class="False">    1706:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">data</span><span class="f">,</span>     <span class="k">/* Unicode char buffer */</span>
<a name="1707" /><span class="False">    1707:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* number of Py_UNICODE chars to encode */</span>
<a name="1708" /><span class="False">    1708:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1709" /><span class="False">    1709:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1710" /><span class="False">    1710:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1711" /><span class="False">    1711:</span> 
<a name="1712" /><span class="False">    1712:</span> <span class="f">#</span><span class="n">if</span> <span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">Py_LIMITED_API</span><span class="f">)</span> <span class="f">||</span> <span class="b">Py_LIMITED_API</span><span class="f">+</span><span class="c">0</span> <span class="f">&gt;=</span> <span class="c">0x03030000</span>
<a name="1713" /><span class="False">    1713:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_EncodeCodePage</span><span class="f">(</span>
<a name="1714" /><span class="False">    1714:</span>     <span class="m">int</span> <span class="b">code_page</span><span class="f">,</span>              <span class="k">/* code page number */</span>
<a name="1715" /><span class="False">    1715:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>          <span class="k">/* Unicode object */</span>
<a name="1716" /><span class="False">    1716:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1717" /><span class="False">    1717:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1718" /><span class="False">    1718:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1719" /><span class="False">    1719:</span> 
<a name="1720" /><span class="True">    1720:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* MS_WINDOWS */</span>
<a name="1721" /><span class="True">    1721:</span> 
<a name="1722" /><span class="True">    1722:</span> <span class="k">/* --- Decimal Encoder ---------------------------------------------------- */</span>
<a name="1723" /><span class="True">    1723:</span> 
<a name="1724" /><span class="True">    1724:</span> <span class="k">/* Takes a Unicode string holding a decimal value and writes it into</span>
<a name="1725" /><span class="True">    1725:</span> <span class="k">   an output buffer using standard ASCII digit codes.</span>
<a name="1726" /><span class="True">    1726:</span> <span class="k"></span>
<a name="1727" /><span class="True">    1727:</span> <span class="k">   The output buffer has to provide at least length+1 bytes of storage</span>
<a name="1728" /><span class="True">    1728:</span> <span class="k">   area. The output string is 0-terminated.</span>
<a name="1729" /><span class="True">    1729:</span> <span class="k"></span>
<a name="1730" /><span class="True">    1730:</span> <span class="k">   The encoder converts whitespace to &apos; &apos;, decimal characters to their</span>
<a name="1731" /><span class="True">    1731:</span> <span class="k">   corresponding ASCII digit and all other Latin-1 characters except</span>
<a name="1732" /><span class="True">    1732:</span> <span class="k">   \0 as-is. Characters outside this range (Unicode ordinals 1-256)</span>
<a name="1733" /><span class="True">    1733:</span> <span class="k">   are treated as errors. This includes embedded NULL bytes.</span>
<a name="1734" /><span class="True">    1734:</span> <span class="k"></span>
<a name="1735" /><span class="True">    1735:</span> <span class="k">   Error handling is defined by the errors argument:</span>
<a name="1736" /><span class="True">    1736:</span> <span class="k"></span>
<a name="1737" /><span class="True">    1737:</span> <span class="k">      NULL or &quot;strict&quot;: raise a ValueError</span>
<a name="1738" /><span class="True">    1738:</span> <span class="k">      &quot;ignore&quot;: ignore the wrong characters (these are not copied to the</span>
<a name="1739" /><span class="True">    1739:</span> <span class="k">                output buffer)</span>
<a name="1740" /><span class="True">    1740:</span> <span class="k">      &quot;replace&quot;: replaces illegal characters with &apos;?&apos;</span>
<a name="1741" /><span class="True">    1741:</span> <span class="k"></span>
<a name="1742" /><span class="True">    1742:</span> <span class="k">   Returns 0 on success, -1 on failure.</span>
<a name="1743" /><span class="True">    1743:</span> <span class="k"></span>
<a name="1744" /><span class="True">    1744:</span> <span class="k">*/</span>
<a name="1745" /><span class="True">    1745:</span> 
<a name="1746" /><span class="True">    1746:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1747" /><span class="True">    1747:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">PyUnicode_EncodeDecimal</span><span class="f">(</span>
<a name="1748" /><span class="True">    1748:</span>     <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s</span><span class="f">,</span>              <span class="k">/* Unicode buffer */</span>
<a name="1749" /><span class="True">    1749:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span><span class="f">,</span>          <span class="k">/* Number of Py_UNICODE chars to encode */</span>
<a name="1750" /><span class="True">    1750:</span>     <span class="m">char</span> <span class="f">*</span><span class="b">output</span><span class="f">,</span>               <span class="k">/* Output buffer; must have size &gt;= length */</span>
<a name="1751" /><span class="True">    1751:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1752" /><span class="True">    1752:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1753" /><span class="True">    1753:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1754" /><span class="True">    1754:</span> 
<a name="1755" /><span class="True">    1755:</span> <span class="k">/* Transforms code points that have decimal digit property to the</span>
<a name="1756" /><span class="True">    1756:</span> <span class="k">   corresponding ASCII digit code points.</span>
<a name="1757" /><span class="True">    1757:</span> <span class="k"></span>
<a name="1758" /><span class="True">    1758:</span> <span class="k">   Returns a new Unicode string on success, NULL on failure.</span>
<a name="1759" /><span class="True">    1759:</span> <span class="k">*/</span>
<a name="1760" /><span class="True">    1760:</span> 
<a name="1761" /><span class="True">    1761:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1762" /><span class="True">    1762:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_TransformDecimalToASCII</span><span class="f">(</span>
<a name="1763" /><span class="True">    1763:</span>     <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s</span><span class="f">,</span>              <span class="k">/* Unicode buffer */</span>
<a name="1764" /><span class="True">    1764:</span>     <span class="b">Py_ssize_t</span> <span class="b">length</span>           <span class="k">/* Number of Py_UNICODE chars to transform */</span>
<a name="1765" /><span class="True">    1765:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1766" /><span class="True">    1766:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1767" /><span class="True">    1767:</span> 
<a name="1768" /><span class="True">    1768:</span> <span class="k">/* Similar to PyUnicode_TransformDecimalToASCII(), but takes a PyObject</span>
<a name="1769" /><span class="True">    1769:</span> <span class="k">   as argument instead of a raw buffer and length.  This function additionally</span>
<a name="1770" /><span class="True">    1770:</span> <span class="k">   transforms spaces to ASCII because this is what the callers in longobject,</span>
<a name="1771" /><span class="True">    1771:</span> <span class="k">   floatobject, and complexobject did anyways. */</span>
<a name="1772" /><span class="True">    1772:</span> 
<a name="1773" /><span class="True">    1773:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1774" /><span class="True">    1774:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_TransformDecimalAndSpaceToASCII</span><span class="f">(</span>
<a name="1775" /><span class="True">    1775:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>           <span class="k">/* Unicode object */</span>
<a name="1776" /><span class="True">    1776:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1777" /><span class="True">    1777:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1778" /><span class="True">    1778:</span> 
<a name="1779" /><span class="True">    1779:</span> <span class="k">/* --- Locale encoding --------------------------------------------------- */</span>
<a name="1780" /><span class="True">    1780:</span> 
<a name="1781" /><span class="True">    1781:</span> <span class="f">#</span><span class="n">if</span> <span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">Py_LIMITED_API</span><span class="f">)</span> <span class="f">||</span> <span class="b">Py_LIMITED_API</span><span class="f">+</span><span class="c">0</span> <span class="f">&gt;=</span> <span class="c">0x03030000</span>
<a name="1782" /><span class="True">    1782:</span> <span class="k">/* Decode a string from the current locale encoding. The decoder is strict if</span>
<a name="1783" /><span class="True">    1783:</span> <span class="k">   *surrogateescape* is equal to zero, otherwise it uses the &apos;surrogateescape&apos;</span>
<a name="1784" /><span class="True">    1784:</span> <span class="k">   error handler (PEP 383) to escape undecodable bytes. If a byte sequence can</span>
<a name="1785" /><span class="True">    1785:</span> <span class="k">   be decoded as a surrogate character and *surrogateescape* is not equal to</span>
<a name="1786" /><span class="True">    1786:</span> <span class="k">   zero, the byte sequence is escaped using the &apos;surrogateescape&apos; error handler</span>
<a name="1787" /><span class="True">    1787:</span> <span class="k">   instead of being decoded. *str* must end with a null character but cannot</span>
<a name="1788" /><span class="True">    1788:</span> <span class="k">   contain embedded null characters. */</span>
<a name="1789" /><span class="True">    1789:</span> 
<a name="1790" /><span class="True">    1790:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeLocaleAndSize</span><span class="f">(</span>
<a name="1791" /><span class="True">    1791:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">str</span><span class="f">,</span>
<a name="1792" /><span class="True">    1792:</span>     <span class="b">Py_ssize_t</span> <span class="b">len</span><span class="f">,</span>
<a name="1793" /><span class="True">    1793:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">)</span><span class="f">;</span>
<a name="1794" /><span class="True">    1794:</span> 
<a name="1795" /><span class="True">    1795:</span> <span class="k">/* Similar to PyUnicode_DecodeLocaleAndSize(), but compute the string</span>
<a name="1796" /><span class="True">    1796:</span> <span class="k">   length using strlen(). */</span>
<a name="1797" /><span class="True">    1797:</span> 
<a name="1798" /><span class="True">    1798:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeLocale</span><span class="f">(</span>
<a name="1799" /><span class="True">    1799:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">str</span><span class="f">,</span>
<a name="1800" /><span class="True">    1800:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span><span class="f">)</span><span class="f">;</span>
<a name="1801" /><span class="True">    1801:</span> 
<a name="1802" /><span class="True">    1802:</span> <span class="k">/* Encode a Unicode object to the current locale encoding. The encoder is</span>
<a name="1803" /><span class="True">    1803:</span> <span class="k">   strict is *surrogateescape* is equal to zero, otherwise the</span>
<a name="1804" /><span class="True">    1804:</span> <span class="k">   &quot;surrogateescape&quot; error handler is used. Return a bytes object. The string</span>
<a name="1805" /><span class="True">    1805:</span> <span class="k">   cannot contain embedded null characters. */</span>
<a name="1806" /><span class="True">    1806:</span> 
<a name="1807" /><span class="True">    1807:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_EncodeLocale</span><span class="f">(</span>
<a name="1808" /><span class="True">    1808:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>
<a name="1809" /><span class="True">    1809:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>
<a name="1810" /><span class="True">    1810:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1811" /><span class="True">    1811:</span> <span class="f">#</span><span class="n">endif</span>
<a name="1812" /><span class="True">    1812:</span> 
<a name="1813" /><span class="True">    1813:</span> <span class="k">/* --- File system encoding ---------------------------------------------- */</span>
<a name="1814" /><span class="True">    1814:</span> 
<a name="1815" /><span class="True">    1815:</span> <span class="k">/* ParseTuple converter: encode str objects to bytes using</span>
<a name="1816" /><span class="True">    1816:</span> <span class="k">   PyUnicode_EncodeFSDefault(); bytes objects are output as-is. */</span>
<a name="1817" /><span class="True">    1817:</span> 
<a name="1818" /><span class="True">    1818:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">PyUnicode_FSConverter</span><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">,</span> <span class="m">void</span><span class="f">*</span><span class="f">)</span><span class="f">;</span>
<a name="1819" /><span class="True">    1819:</span> 
<a name="1820" /><span class="True">    1820:</span> <span class="k">/* ParseTuple converter: decode bytes objects to unicode using</span>
<a name="1821" /><span class="True">    1821:</span> <span class="k">   PyUnicode_DecodeFSDefaultAndSize(); str objects are output as-is. */</span>
<a name="1822" /><span class="True">    1822:</span> 
<a name="1823" /><span class="True">    1823:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">PyUnicode_FSDecoder</span><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">,</span> <span class="m">void</span><span class="f">*</span><span class="f">)</span><span class="f">;</span>
<a name="1824" /><span class="True">    1824:</span> 
<a name="1825" /><span class="True">    1825:</span> <span class="k">/* Decode a null-terminated string using Py_FileSystemDefaultEncoding</span>
<a name="1826" /><span class="True">    1826:</span> <span class="k">   and the &quot;surrogateescape&quot; error handler.</span>
<a name="1827" /><span class="True">    1827:</span> <span class="k"></span>
<a name="1828" /><span class="True">    1828:</span> <span class="k">   If Py_FileSystemDefaultEncoding is not set, fall back to the locale</span>
<a name="1829" /><span class="True">    1829:</span> <span class="k">   encoding.</span>
<a name="1830" /><span class="True">    1830:</span> <span class="k"></span>
<a name="1831" /><span class="True">    1831:</span> <span class="k">   Use PyUnicode_DecodeFSDefaultAndSize() if the string length is known.</span>
<a name="1832" /><span class="True">    1832:</span> <span class="k">*/</span>
<a name="1833" /><span class="True">    1833:</span> 
<a name="1834" /><span class="True">    1834:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeFSDefault</span><span class="f">(</span>
<a name="1835" /><span class="True">    1835:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">s</span>               <span class="k">/* encoded string */</span>
<a name="1836" /><span class="True">    1836:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1837" /><span class="True">    1837:</span> 
<a name="1838" /><span class="True">    1838:</span> <span class="k">/* Decode a string using Py_FileSystemDefaultEncoding</span>
<a name="1839" /><span class="True">    1839:</span> <span class="k">   and the &quot;surrogateescape&quot; error handler.</span>
<a name="1840" /><span class="True">    1840:</span> <span class="k"></span>
<a name="1841" /><span class="True">    1841:</span> <span class="k">   If Py_FileSystemDefaultEncoding is not set, fall back to the locale</span>
<a name="1842" /><span class="True">    1842:</span> <span class="k">   encoding.</span>
<a name="1843" /><span class="True">    1843:</span> <span class="k">*/</span>
<a name="1844" /><span class="True">    1844:</span> 
<a name="1845" /><span class="True">    1845:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_DecodeFSDefaultAndSize</span><span class="f">(</span>
<a name="1846" /><span class="True">    1846:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">s</span><span class="f">,</span>               <span class="k">/* encoded string */</span>
<a name="1847" /><span class="True">    1847:</span>     <span class="b">Py_ssize_t</span> <span class="b">size</span>              <span class="k">/* size */</span>
<a name="1848" /><span class="True">    1848:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1849" /><span class="True">    1849:</span> 
<a name="1850" /><span class="True">    1850:</span> <span class="k">/* Encode a Unicode object to Py_FileSystemDefaultEncoding with the</span>
<a name="1851" /><span class="True">    1851:</span> <span class="k">   &quot;surrogateescape&quot; error handler, and return bytes.</span>
<a name="1852" /><span class="True">    1852:</span> <span class="k"></span>
<a name="1853" /><span class="True">    1853:</span> <span class="k">   If Py_FileSystemDefaultEncoding is not set, fall back to the locale</span>
<a name="1854" /><span class="True">    1854:</span> <span class="k">   encoding.</span>
<a name="1855" /><span class="True">    1855:</span> <span class="k">*/</span>
<a name="1856" /><span class="True">    1856:</span> 
<a name="1857" /><span class="True">    1857:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_EncodeFSDefault</span><span class="f">(</span>
<a name="1858" /><span class="True">    1858:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>
<a name="1859" /><span class="True">    1859:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1860" /><span class="True">    1860:</span> 
<a name="1861" /><span class="True">    1861:</span> <span class="k">/* --- Methods &amp; Slots ----------------------------------------------------</span>
<a name="1862" /><span class="True">    1862:</span> <span class="k"></span>
<a name="1863" /><span class="True">    1863:</span> <span class="k">   These are capable of handling Unicode objects and strings on input</span>
<a name="1864" /><span class="True">    1864:</span> <span class="k">   (we refer to them as strings in the descriptions) and return</span>
<a name="1865" /><span class="True">    1865:</span> <span class="k">   Unicode objects or integers as appropriate. */</span>
<a name="1866" /><span class="True">    1866:</span> 
<a name="1867" /><span class="True">    1867:</span> <span class="k">/* Concat two strings giving a new Unicode string. */</span>
<a name="1868" /><span class="True">    1868:</span> 
<a name="1869" /><span class="True">    1869:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_Concat</span><span class="f">(</span>
<a name="1870" /><span class="True">    1870:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">left</span><span class="f">,</span>             <span class="k">/* Left string */</span>
<a name="1871" /><span class="True">    1871:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">right</span>             <span class="k">/* Right string */</span>
<a name="1872" /><span class="True">    1872:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1873" /><span class="True">    1873:</span> 
<a name="1874" /><span class="True">    1874:</span> <span class="k">/* Concat two strings and put the result in *pleft</span>
<a name="1875" /><span class="True">    1875:</span> <span class="k">   (sets *pleft to NULL on error) */</span>
<a name="1876" /><span class="True">    1876:</span> 
<a name="1877" /><span class="True">    1877:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">void</span><span class="f">)</span> <span class="b">PyUnicode_Append</span><span class="f">(</span>
<a name="1878" /><span class="True">    1878:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="f">*</span><span class="b">pleft</span><span class="f">,</span>           <span class="k">/* Pointer to left string */</span>
<a name="1879" /><span class="True">    1879:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">right</span>             <span class="k">/* Right string */</span>
<a name="1880" /><span class="True">    1880:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1881" /><span class="True">    1881:</span> 
<a name="1882" /><span class="True">    1882:</span> <span class="k">/* Concat two strings, put the result in *pleft and drop the right object</span>
<a name="1883" /><span class="True">    1883:</span> <span class="k">   (sets *pleft to NULL on error) */</span>
<a name="1884" /><span class="True">    1884:</span> 
<a name="1885" /><span class="True">    1885:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">void</span><span class="f">)</span> <span class="b">PyUnicode_AppendAndDel</span><span class="f">(</span>
<a name="1886" /><span class="True">    1886:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="f">*</span><span class="b">pleft</span><span class="f">,</span>           <span class="k">/* Pointer to left string */</span>
<a name="1887" /><span class="True">    1887:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">right</span>             <span class="k">/* Right string */</span>
<a name="1888" /><span class="True">    1888:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1889" /><span class="True">    1889:</span> 
<a name="1890" /><span class="True">    1890:</span> <span class="k">/* Split a string giving a list of Unicode strings.</span>
<a name="1891" /><span class="True">    1891:</span> <span class="k"></span>
<a name="1892" /><span class="True">    1892:</span> <span class="k">   If sep is NULL, splitting will be done at all whitespace</span>
<a name="1893" /><span class="True">    1893:</span> <span class="k">   substrings. Otherwise, splits occur at the given separator.</span>
<a name="1894" /><span class="True">    1894:</span> <span class="k"></span>
<a name="1895" /><span class="True">    1895:</span> <span class="k">   At most maxsplit splits will be done. If negative, no limit is set.</span>
<a name="1896" /><span class="True">    1896:</span> <span class="k"></span>
<a name="1897" /><span class="True">    1897:</span> <span class="k">   Separators are not included in the resulting list.</span>
<a name="1898" /><span class="True">    1898:</span> <span class="k"></span>
<a name="1899" /><span class="True">    1899:</span> <span class="k">*/</span>
<a name="1900" /><span class="True">    1900:</span> 
<a name="1901" /><span class="True">    1901:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_Split</span><span class="f">(</span>
<a name="1902" /><span class="True">    1902:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">s</span><span class="f">,</span>                <span class="k">/* String to split */</span>
<a name="1903" /><span class="True">    1903:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">sep</span><span class="f">,</span>              <span class="k">/* String separator */</span>
<a name="1904" /><span class="True">    1904:</span>     <span class="b">Py_ssize_t</span> <span class="b">maxsplit</span>         <span class="k">/* Maxsplit count */</span>
<a name="1905" /><span class="True">    1905:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1906" /><span class="True">    1906:</span> 
<a name="1907" /><span class="True">    1907:</span> <span class="k">/* Dito, but split at line breaks.</span>
<a name="1908" /><span class="True">    1908:</span> <span class="k"></span>
<a name="1909" /><span class="True">    1909:</span> <span class="k">   CRLF is considered to be one line break. Line breaks are not</span>
<a name="1910" /><span class="True">    1910:</span> <span class="k">   included in the resulting list. */</span>
<a name="1911" /><span class="True">    1911:</span> 
<a name="1912" /><span class="True">    1912:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_Splitlines</span><span class="f">(</span>
<a name="1913" /><span class="True">    1913:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">s</span><span class="f">,</span>                <span class="k">/* String to split */</span>
<a name="1914" /><span class="True">    1914:</span>     <span class="m">int</span> <span class="b">keepends</span>                <span class="k">/* If true, line end markers are included */</span>
<a name="1915" /><span class="True">    1915:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1916" /><span class="True">    1916:</span> 
<a name="1917" /><span class="True">    1917:</span> <span class="k">/* Partition a string using a given separator. */</span>
<a name="1918" /><span class="True">    1918:</span> 
<a name="1919" /><span class="True">    1919:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_Partition</span><span class="f">(</span>
<a name="1920" /><span class="True">    1920:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">s</span><span class="f">,</span>                <span class="k">/* String to partition */</span>
<a name="1921" /><span class="True">    1921:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">sep</span>               <span class="k">/* String separator */</span>
<a name="1922" /><span class="True">    1922:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1923" /><span class="True">    1923:</span> 
<a name="1924" /><span class="True">    1924:</span> <span class="k">/* Partition a string using a given separator, searching from the end of the</span>
<a name="1925" /><span class="True">    1925:</span> <span class="k">   string. */</span>
<a name="1926" /><span class="True">    1926:</span> 
<a name="1927" /><span class="True">    1927:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_RPartition</span><span class="f">(</span>
<a name="1928" /><span class="True">    1928:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">s</span><span class="f">,</span>                <span class="k">/* String to partition */</span>
<a name="1929" /><span class="True">    1929:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">sep</span>               <span class="k">/* String separator */</span>
<a name="1930" /><span class="True">    1930:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1931" /><span class="True">    1931:</span> 
<a name="1932" /><span class="True">    1932:</span> <span class="k">/* Split a string giving a list of Unicode strings.</span>
<a name="1933" /><span class="True">    1933:</span> <span class="k"></span>
<a name="1934" /><span class="True">    1934:</span> <span class="k">   If sep is NULL, splitting will be done at all whitespace</span>
<a name="1935" /><span class="True">    1935:</span> <span class="k">   substrings. Otherwise, splits occur at the given separator.</span>
<a name="1936" /><span class="True">    1936:</span> <span class="k"></span>
<a name="1937" /><span class="True">    1937:</span> <span class="k">   At most maxsplit splits will be done. But unlike PyUnicode_Split</span>
<a name="1938" /><span class="True">    1938:</span> <span class="k">   PyUnicode_RSplit splits from the end of the string. If negative,</span>
<a name="1939" /><span class="True">    1939:</span> <span class="k">   no limit is set.</span>
<a name="1940" /><span class="True">    1940:</span> <span class="k"></span>
<a name="1941" /><span class="True">    1941:</span> <span class="k">   Separators are not included in the resulting list.</span>
<a name="1942" /><span class="True">    1942:</span> <span class="k"></span>
<a name="1943" /><span class="True">    1943:</span> <span class="k">*/</span>
<a name="1944" /><span class="True">    1944:</span> 
<a name="1945" /><span class="True">    1945:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_RSplit</span><span class="f">(</span>
<a name="1946" /><span class="True">    1946:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">s</span><span class="f">,</span>                <span class="k">/* String to split */</span>
<a name="1947" /><span class="True">    1947:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">sep</span><span class="f">,</span>              <span class="k">/* String separator */</span>
<a name="1948" /><span class="True">    1948:</span>     <span class="b">Py_ssize_t</span> <span class="b">maxsplit</span>         <span class="k">/* Maxsplit count */</span>
<a name="1949" /><span class="True">    1949:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1950" /><span class="True">    1950:</span> 
<a name="1951" /><span class="True">    1951:</span> <span class="k">/* Translate a string by applying a character mapping table to it and</span>
<a name="1952" /><span class="True">    1952:</span> <span class="k">   return the resulting Unicode object.</span>
<a name="1953" /><span class="True">    1953:</span> <span class="k"></span>
<a name="1954" /><span class="True">    1954:</span> <span class="k">   The mapping table must map Unicode ordinal integers to Unicode strings,</span>
<a name="1955" /><span class="True">    1955:</span> <span class="k">   Unicode ordinal integers or None (causing deletion of the character).</span>
<a name="1956" /><span class="True">    1956:</span> <span class="k"></span>
<a name="1957" /><span class="True">    1957:</span> <span class="k">   Mapping tables may be dictionaries or sequences. Unmapped character</span>
<a name="1958" /><span class="True">    1958:</span> <span class="k">   ordinals (ones which cause a LookupError) are left untouched and</span>
<a name="1959" /><span class="True">    1959:</span> <span class="k">   are copied as-is.</span>
<a name="1960" /><span class="True">    1960:</span> <span class="k"></span>
<a name="1961" /><span class="True">    1961:</span> <span class="k">*/</span>
<a name="1962" /><span class="True">    1962:</span> 
<a name="1963" /><span class="True">    1963:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_Translate</span><span class="f">(</span>
<a name="1964" /><span class="True">    1964:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">str</span><span class="f">,</span>              <span class="k">/* String */</span>
<a name="1965" /><span class="True">    1965:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">table</span><span class="f">,</span>            <span class="k">/* Translate table */</span>
<a name="1966" /><span class="True">    1966:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">errors</span>          <span class="k">/* error handling */</span>
<a name="1967" /><span class="True">    1967:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1968" /><span class="True">    1968:</span> 
<a name="1969" /><span class="True">    1969:</span> <span class="k">/* Join a sequence of strings using the given separator and return</span>
<a name="1970" /><span class="True">    1970:</span> <span class="k">   the resulting Unicode string. */</span>
<a name="1971" /><span class="True">    1971:</span> 
<a name="1972" /><span class="True">    1972:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_Join</span><span class="f">(</span>
<a name="1973" /><span class="True">    1973:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">separator</span><span class="f">,</span>        <span class="k">/* Separator string */</span>
<a name="1974" /><span class="True">    1974:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">seq</span>               <span class="k">/* Sequence object */</span>
<a name="1975" /><span class="True">    1975:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1976" /><span class="True">    1976:</span> 
<a name="1977" /><span class="True">    1977:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="1978" /><span class="True">    1978:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_JoinArray</span><span class="f">(</span>
<a name="1979" /><span class="True">    1979:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">separator</span><span class="f">,</span>
<a name="1980" /><span class="True">    1980:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="f">*</span><span class="b">items</span><span class="f">,</span>
<a name="1981" /><span class="True">    1981:</span>     <span class="b">Py_ssize_t</span> <span class="b">seqlen</span>
<a name="1982" /><span class="True">    1982:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1983" /><span class="True">    1983:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* Py_LIMITED_API */</span>
<a name="1984" /><span class="True">    1984:</span> 
<a name="1985" /><span class="True">    1985:</span> <span class="k">/* Return 1 if substr matches str[start:end] at the given tail end, 0</span>
<a name="1986" /><span class="True">    1986:</span> <span class="k">   otherwise. */</span>
<a name="1987" /><span class="True">    1987:</span> 
<a name="1988" /><span class="True">    1988:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_ssize_t</span><span class="f">)</span> <span class="b">PyUnicode_Tailmatch</span><span class="f">(</span>
<a name="1989" /><span class="True">    1989:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">str</span><span class="f">,</span>              <span class="k">/* String */</span>
<a name="1990" /><span class="True">    1990:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">substr</span><span class="f">,</span>           <span class="k">/* Prefix or Suffix string */</span>
<a name="1991" /><span class="True">    1991:</span>     <span class="b">Py_ssize_t</span> <span class="b">start</span><span class="f">,</span>           <span class="k">/* Start index */</span>
<a name="1992" /><span class="True">    1992:</span>     <span class="b">Py_ssize_t</span> <span class="b">end</span><span class="f">,</span>             <span class="k">/* Stop index */</span>
<a name="1993" /><span class="True">    1993:</span>     <span class="m">int</span> <span class="b">direction</span>               <span class="k">/* Tail end: -1 prefix, +1 suffix */</span>
<a name="1994" /><span class="True">    1994:</span>     <span class="f">)</span><span class="f">;</span>
<a name="1995" /><span class="True">    1995:</span> 
<a name="1996" /><span class="True">    1996:</span> <span class="k">/* Return the first position of substr in str[start:end] using the</span>
<a name="1997" /><span class="True">    1997:</span> <span class="k">   given search direction or -1 if not found. -2 is returned in case</span>
<a name="1998" /><span class="True">    1998:</span> <span class="k">   an error occurred and an exception is set. */</span>
<a name="1999" /><span class="True">    1999:</span> 
<a name="2000" /><span class="True">    2000:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_ssize_t</span><span class="f">)</span> <span class="b">PyUnicode_Find</span><span class="f">(</span>
<a name="2001" /><span class="True">    2001:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">str</span><span class="f">,</span>              <span class="k">/* String */</span>
<a name="2002" /><span class="True">    2002:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">substr</span><span class="f">,</span>           <span class="k">/* Substring to find */</span>
<a name="2003" /><span class="True">    2003:</span>     <span class="b">Py_ssize_t</span> <span class="b">start</span><span class="f">,</span>           <span class="k">/* Start index */</span>
<a name="2004" /><span class="True">    2004:</span>     <span class="b">Py_ssize_t</span> <span class="b">end</span><span class="f">,</span>             <span class="k">/* Stop index */</span>
<a name="2005" /><span class="True">    2005:</span>     <span class="m">int</span> <span class="b">direction</span>               <span class="k">/* Find direction: +1 forward, -1 backward */</span>
<a name="2006" /><span class="True">    2006:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2007" /><span class="True">    2007:</span> 
<a name="2008" /><span class="True">    2008:</span> <span class="f">#</span><span class="n">if</span> <span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">Py_LIMITED_API</span><span class="f">)</span> <span class="f">||</span> <span class="b">Py_LIMITED_API</span><span class="f">+</span><span class="c">0</span> <span class="f">&gt;=</span> <span class="c">0x03030000</span>
<a name="2009" /><span class="True">    2009:</span> <span class="k">/* Like PyUnicode_Find, but search for single character only. */</span>
<a name="2010" /><span class="True">    2010:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_ssize_t</span><span class="f">)</span> <span class="b">PyUnicode_FindChar</span><span class="f">(</span>
<a name="2011" /><span class="True">    2011:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">str</span><span class="f">,</span>
<a name="2012" /><span class="True">    2012:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span><span class="f">,</span>
<a name="2013" /><span class="True">    2013:</span>     <span class="b">Py_ssize_t</span> <span class="b">start</span><span class="f">,</span>
<a name="2014" /><span class="True">    2014:</span>     <span class="b">Py_ssize_t</span> <span class="b">end</span><span class="f">,</span>
<a name="2015" /><span class="True">    2015:</span>     <span class="m">int</span> <span class="b">direction</span>
<a name="2016" /><span class="True">    2016:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2017" /><span class="True">    2017:</span> <span class="f">#</span><span class="n">endif</span>
<a name="2018" /><span class="True">    2018:</span> 
<a name="2019" /><span class="True">    2019:</span> <span class="k">/* Count the number of occurrences of substr in str[start:end]. */</span>
<a name="2020" /><span class="True">    2020:</span> 
<a name="2021" /><span class="True">    2021:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_ssize_t</span><span class="f">)</span> <span class="b">PyUnicode_Count</span><span class="f">(</span>
<a name="2022" /><span class="True">    2022:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">str</span><span class="f">,</span>              <span class="k">/* String */</span>
<a name="2023" /><span class="True">    2023:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">substr</span><span class="f">,</span>           <span class="k">/* Substring to count */</span>
<a name="2024" /><span class="True">    2024:</span>     <span class="b">Py_ssize_t</span> <span class="b">start</span><span class="f">,</span>           <span class="k">/* Start index */</span>
<a name="2025" /><span class="True">    2025:</span>     <span class="b">Py_ssize_t</span> <span class="b">end</span>              <span class="k">/* Stop index */</span>
<a name="2026" /><span class="True">    2026:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2027" /><span class="True">    2027:</span> 
<a name="2028" /><span class="True">    2028:</span> <span class="k">/* Replace at most maxcount occurrences of substr in str with replstr</span>
<a name="2029" /><span class="True">    2029:</span> <span class="k">   and return the resulting Unicode object. */</span>
<a name="2030" /><span class="True">    2030:</span> 
<a name="2031" /><span class="True">    2031:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_Replace</span><span class="f">(</span>
<a name="2032" /><span class="True">    2032:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">str</span><span class="f">,</span>              <span class="k">/* String */</span>
<a name="2033" /><span class="True">    2033:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">substr</span><span class="f">,</span>           <span class="k">/* Substring to find */</span>
<a name="2034" /><span class="True">    2034:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">replstr</span><span class="f">,</span>          <span class="k">/* Substring to replace */</span>
<a name="2035" /><span class="True">    2035:</span>     <span class="b">Py_ssize_t</span> <span class="b">maxcount</span>         <span class="k">/* Max. number of replacements to apply;</span>
<a name="2036" /><span class="True">    2036:</span> <span class="k">                                   -1 = all */</span>
<a name="2037" /><span class="True">    2037:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2038" /><span class="True">    2038:</span> 
<a name="2039" /><span class="True">    2039:</span> <span class="k">/* Compare two strings and return -1, 0, 1 for less than, equal,</span>
<a name="2040" /><span class="True">    2040:</span> <span class="k">   greater than resp.</span>
<a name="2041" /><span class="True">    2041:</span> <span class="k">   Raise an exception and return -1 on error. */</span>
<a name="2042" /><span class="True">    2042:</span> 
<a name="2043" /><span class="True">    2043:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">PyUnicode_Compare</span><span class="f">(</span>
<a name="2044" /><span class="True">    2044:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">left</span><span class="f">,</span>             <span class="k">/* Left string */</span>
<a name="2045" /><span class="True">    2045:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">right</span>             <span class="k">/* Right string */</span>
<a name="2046" /><span class="True">    2046:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2047" /><span class="True">    2047:</span> 
<a name="2048" /><span class="True">    2048:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="2049" /><span class="True">    2049:</span> <span class="k">/* Test whether a unicode is equal to ASCII identifier.  Return 1 if true,</span>
<a name="2050" /><span class="True">    2050:</span> <span class="k">   0 otherwise.  The right argument must be ASCII identifier.</span>
<a name="2051" /><span class="True">    2051:</span> <span class="k">   Any error occurs inside will be cleared before return. */</span>
<a name="2052" /><span class="True">    2052:</span> 
<a name="2053" /><span class="True">    2053:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_EqualToASCIIId</span><span class="f">(</span>
<a name="2054" /><span class="True">    2054:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">left</span><span class="f">,</span>             <span class="k">/* Left string */</span>
<a name="2055" /><span class="True">    2055:</span>     <span class="b">_Py_Identifier</span> <span class="f">*</span><span class="b">right</span>       <span class="k">/* Right identifier */</span>
<a name="2056" /><span class="True">    2056:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2057" /><span class="True">    2057:</span> <span class="f">#</span><span class="n">endif</span>
<a name="2058" /><span class="True">    2058:</span> 
<a name="2059" /><span class="True">    2059:</span> <span class="k">/* Compare a Unicode object with C string and return -1, 0, 1 for less than,</span>
<a name="2060" /><span class="True">    2060:</span> <span class="k">   equal, and greater than, respectively.  It is best to pass only</span>
<a name="2061" /><span class="True">    2061:</span> <span class="k">   ASCII-encoded strings, but the function interprets the input string as</span>
<a name="2062" /><span class="True">    2062:</span> <span class="k">   ISO-8859-1 if it contains non-ASCII characters.</span>
<a name="2063" /><span class="True">    2063:</span> <span class="k">   This function does not raise exceptions. */</span>
<a name="2064" /><span class="True">    2064:</span> 
<a name="2065" /><span class="True">    2065:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">PyUnicode_CompareWithASCIIString</span><span class="f">(</span>
<a name="2066" /><span class="True">    2066:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">left</span><span class="f">,</span>
<a name="2067" /><span class="True">    2067:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">right</span>           <span class="k">/* ASCII-encoded string */</span>
<a name="2068" /><span class="True">    2068:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2069" /><span class="True">    2069:</span> 
<a name="2070" /><span class="True">    2070:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="2071" /><span class="True">    2071:</span> <span class="k">/* Test whether a unicode is equal to ASCII string.  Return 1 if true,</span>
<a name="2072" /><span class="True">    2072:</span> <span class="k">   0 otherwise.  The right argument must be ASCII-encoded string.</span>
<a name="2073" /><span class="True">    2073:</span> <span class="k">   Any error occurs inside will be cleared before return. */</span>
<a name="2074" /><span class="True">    2074:</span> 
<a name="2075" /><span class="True">    2075:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_EqualToASCIIString</span><span class="f">(</span>
<a name="2076" /><span class="True">    2076:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">left</span><span class="f">,</span>
<a name="2077" /><span class="True">    2077:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">right</span>           <span class="k">/* ASCII-encoded string */</span>
<a name="2078" /><span class="True">    2078:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2079" /><span class="True">    2079:</span> <span class="f">#</span><span class="n">endif</span>
<a name="2080" /><span class="True">    2080:</span> 
<a name="2081" /><span class="True">    2081:</span> <span class="k">/* Rich compare two strings and return one of the following:</span>
<a name="2082" /><span class="True">    2082:</span> <span class="k"></span>
<a name="2083" /><span class="True">    2083:</span> <span class="k">   - NULL in case an exception was raised</span>
<a name="2084" /><span class="True">    2084:</span> <span class="k">   - Py_True or Py_False for successful comparisons</span>
<a name="2085" /><span class="True">    2085:</span> <span class="k">   - Py_NotImplemented in case the type combination is unknown</span>
<a name="2086" /><span class="True">    2086:</span> <span class="k"></span>
<a name="2087" /><span class="True">    2087:</span> <span class="k">   Possible values for op:</span>
<a name="2088" /><span class="True">    2088:</span> <span class="k"></span>
<a name="2089" /><span class="True">    2089:</span> <span class="k">     Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE</span>
<a name="2090" /><span class="True">    2090:</span> <span class="k"></span>
<a name="2091" /><span class="True">    2091:</span> <span class="k">*/</span>
<a name="2092" /><span class="True">    2092:</span> 
<a name="2093" /><span class="True">    2093:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_RichCompare</span><span class="f">(</span>
<a name="2094" /><span class="True">    2094:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">left</span><span class="f">,</span>             <span class="k">/* Left string */</span>
<a name="2095" /><span class="True">    2095:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">right</span><span class="f">,</span>            <span class="k">/* Right string */</span>
<a name="2096" /><span class="True">    2096:</span>     <span class="m">int</span> <span class="b">op</span>                      <span class="k">/* Operation: Py_EQ, Py_NE, Py_GT, etc. */</span>
<a name="2097" /><span class="True">    2097:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2098" /><span class="True">    2098:</span> 
<a name="2099" /><span class="True">    2099:</span> <span class="k">/* Apply an argument tuple or dictionary to a format string and return</span>
<a name="2100" /><span class="True">    2100:</span> <span class="k">   the resulting Unicode string. */</span>
<a name="2101" /><span class="True">    2101:</span> 
<a name="2102" /><span class="True">    2102:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_Format</span><span class="f">(</span>
<a name="2103" /><span class="True">    2103:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">format</span><span class="f">,</span>           <span class="k">/* Format string */</span>
<a name="2104" /><span class="True">    2104:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">args</span>              <span class="k">/* Argument tuple or dictionary */</span>
<a name="2105" /><span class="True">    2105:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2106" /><span class="True">    2106:</span> 
<a name="2107" /><span class="True">    2107:</span> <span class="k">/* Checks whether element is contained in container and return 1/0</span>
<a name="2108" /><span class="True">    2108:</span> <span class="k">   accordingly.</span>
<a name="2109" /><span class="True">    2109:</span> <span class="k"></span>
<a name="2110" /><span class="True">    2110:</span> <span class="k">   element has to coerce to a one element Unicode string. -1 is</span>
<a name="2111" /><span class="True">    2111:</span> <span class="k">   returned in case of an error. */</span>
<a name="2112" /><span class="True">    2112:</span> 
<a name="2113" /><span class="True">    2113:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">PyUnicode_Contains</span><span class="f">(</span>
<a name="2114" /><span class="True">    2114:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">container</span><span class="f">,</span>        <span class="k">/* Container string */</span>
<a name="2115" /><span class="True">    2115:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">element</span>           <span class="k">/* Element string */</span>
<a name="2116" /><span class="True">    2116:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2117" /><span class="True">    2117:</span> 
<a name="2118" /><span class="True">    2118:</span> <span class="k">/* Checks whether argument is a valid identifier. */</span>
<a name="2119" /><span class="True">    2119:</span> 
<a name="2120" /><span class="True">    2120:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">PyUnicode_IsIdentifier</span><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="b">s</span><span class="f">)</span><span class="f">;</span>
<a name="2121" /><span class="True">    2121:</span> 
<a name="2122" /><span class="True">    2122:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="2123" /><span class="True">    2123:</span> <span class="k">/* Externally visible for str.strip(unicode) */</span>
<a name="2124" /><span class="True">    2124:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_XStrip</span><span class="f">(</span>
<a name="2125" /><span class="True">    2125:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">self</span><span class="f">,</span>
<a name="2126" /><span class="True">    2126:</span>     <span class="m">int</span> <span class="b">striptype</span><span class="f">,</span>
<a name="2127" /><span class="True">    2127:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">sepobj</span>
<a name="2128" /><span class="True">    2128:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2129" /><span class="True">    2129:</span> <span class="f">#</span><span class="n">endif</span>
<a name="2130" /><span class="True">    2130:</span> 
<a name="2131" /><span class="True">    2131:</span> <span class="k">/* Using explicit passed-in values, insert the thousands grouping</span>
<a name="2132" /><span class="True">    2132:</span> <span class="k">   into the string pointed to by buffer.  For the argument descriptions,</span>
<a name="2133" /><span class="True">    2133:</span> <span class="k">   see Objects/stringlib/localeutil.h */</span>
<a name="2134" /><span class="True">    2134:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="2135" /><span class="True">    2135:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_ssize_t</span><span class="f">)</span> <span class="b">_PyUnicode_InsertThousandsGrouping</span><span class="f">(</span>
<a name="2136" /><span class="True">    2136:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span><span class="f">,</span>
<a name="2137" /><span class="True">    2137:</span>     <span class="b">Py_ssize_t</span> <span class="b">index</span><span class="f">,</span>
<a name="2138" /><span class="True">    2138:</span>     <span class="b">Py_ssize_t</span> <span class="b">n_buffer</span><span class="f">,</span>
<a name="2139" /><span class="True">    2139:</span>     <span class="m">void</span> <span class="f">*</span><span class="b">digits</span><span class="f">,</span>
<a name="2140" /><span class="True">    2140:</span>     <span class="b">Py_ssize_t</span> <span class="b">n_digits</span><span class="f">,</span>
<a name="2141" /><span class="True">    2141:</span>     <span class="b">Py_ssize_t</span> <span class="b">min_width</span><span class="f">,</span>
<a name="2142" /><span class="True">    2142:</span>     <span class="m">const</span> <span class="m">char</span> <span class="f">*</span><span class="b">grouping</span><span class="f">,</span>
<a name="2143" /><span class="True">    2143:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">thousands_sep</span><span class="f">,</span>
<a name="2144" /><span class="True">    2144:</span>     <span class="b">Py_UCS4</span> <span class="f">*</span><span class="b">maxchar</span><span class="f">)</span><span class="f">;</span>
<a name="2145" /><span class="True">    2145:</span> <span class="f">#</span><span class="n">endif</span>
<a name="2146" /><span class="True">    2146:</span> <span class="k">/* === Characters Type APIs =============================================== */</span>
<a name="2147" /><span class="True">    2147:</span> 
<a name="2148" /><span class="True">    2148:</span> <span class="k">/* Helper array used by Py_UNICODE_ISSPACE(). */</span>
<a name="2149" /><span class="True">    2149:</span> 
<a name="2150" /><span class="True">    2150:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="2151" /><span class="True">    2151:</span> <a href="macros_ref.html#_UHlBUElfREFUQV8w"><span class="b">PyAPI_DATA</span></a><span class="f">(</span><span class="m">const</span> <span class="m">unsigned</span> <span class="m">char</span><span class="f">)</span> <span class="b">_Py_ascii_whitespace</span><span class="f">[</span><span class="f">]</span><span class="f">;</span>
<a name="2152" /><span class="True">    2152:</span> 
<a name="2153" /><span class="True">    2153:</span> <span class="k">/* These should not be used directly. Use the Py_UNICODE_IS* and</span>
<a name="2154" /><span class="True">    2154:</span> <span class="k">   Py_UNICODE_TO* macros instead.</span>
<a name="2155" /><span class="True">    2155:</span> <span class="k"></span>
<a name="2156" /><span class="True">    2156:</span> <span class="k">   These APIs are implemented in Objects/unicodectype.c.</span>
<a name="2157" /><span class="True">    2157:</span> <span class="k"></span>
<a name="2158" /><span class="True">    2158:</span> <span class="k">*/</span>
<a name="2159" /><span class="True">    2159:</span> 
<a name="2160" /><span class="True">    2160:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsLowercase</span><span class="f">(</span>
<a name="2161" /><span class="True">    2161:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2162" /><span class="True">    2162:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2163" /><span class="True">    2163:</span> 
<a name="2164" /><span class="True">    2164:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsUppercase</span><span class="f">(</span>
<a name="2165" /><span class="True">    2165:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2166" /><span class="True">    2166:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2167" /><span class="True">    2167:</span> 
<a name="2168" /><span class="True">    2168:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsTitlecase</span><span class="f">(</span>
<a name="2169" /><span class="True">    2169:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2170" /><span class="True">    2170:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2171" /><span class="True">    2171:</span> 
<a name="2172" /><span class="True">    2172:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsXidStart</span><span class="f">(</span>
<a name="2173" /><span class="True">    2173:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2174" /><span class="True">    2174:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2175" /><span class="True">    2175:</span> 
<a name="2176" /><span class="True">    2176:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsXidContinue</span><span class="f">(</span>
<a name="2177" /><span class="True">    2177:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2178" /><span class="True">    2178:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2179" /><span class="True">    2179:</span> 
<a name="2180" /><span class="True">    2180:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsWhitespace</span><span class="f">(</span>
<a name="2181" /><span class="True">    2181:</span>     <span class="m">const</span> <span class="b">Py_UCS4</span> <span class="b">ch</span>         <span class="k">/* Unicode character */</span>
<a name="2182" /><span class="True">    2182:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2183" /><span class="True">    2183:</span> 
<a name="2184" /><span class="True">    2184:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsLinebreak</span><span class="f">(</span>
<a name="2185" /><span class="True">    2185:</span>     <span class="m">const</span> <span class="b">Py_UCS4</span> <span class="b">ch</span>         <span class="k">/* Unicode character */</span>
<a name="2186" /><span class="True">    2186:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2187" /><span class="True">    2187:</span> 
<a name="2188" /><span class="True">    2188:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UCS4</span><span class="f">)</span> <span class="b">_PyUnicode_ToLowercase</span><span class="f">(</span>
<a name="2189" /><span class="True">    2189:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2190" /><span class="True">    2190:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2191" /><span class="True">    2191:</span> 
<a name="2192" /><span class="True">    2192:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UCS4</span><span class="f">)</span> <span class="b">_PyUnicode_ToUppercase</span><span class="f">(</span>
<a name="2193" /><span class="True">    2193:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2194" /><span class="True">    2194:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2195" /><span class="True">    2195:</span> 
<a name="2196" /><span class="True">    2196:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UCS4</span><span class="f">)</span> <span class="b">_PyUnicode_ToTitlecase</span><span class="f">(</span>
<a name="2197" /><span class="True">    2197:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2198" /><span class="True">    2198:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2199" /><span class="True">    2199:</span> 
<a name="2200" /><span class="True">    2200:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_ToLowerFull</span><span class="f">(</span>
<a name="2201" /><span class="True">    2201:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span><span class="f">,</span>       <span class="k">/* Unicode character */</span>
<a name="2202" /><span class="True">    2202:</span>     <span class="b">Py_UCS4</span> <span class="f">*</span><span class="b">res</span>
<a name="2203" /><span class="True">    2203:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2204" /><span class="True">    2204:</span> 
<a name="2205" /><span class="True">    2205:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_ToTitleFull</span><span class="f">(</span>
<a name="2206" /><span class="True">    2206:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span><span class="f">,</span>       <span class="k">/* Unicode character */</span>
<a name="2207" /><span class="True">    2207:</span>     <span class="b">Py_UCS4</span> <span class="f">*</span><span class="b">res</span>
<a name="2208" /><span class="True">    2208:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2209" /><span class="True">    2209:</span> 
<a name="2210" /><span class="True">    2210:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_ToUpperFull</span><span class="f">(</span>
<a name="2211" /><span class="True">    2211:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span><span class="f">,</span>       <span class="k">/* Unicode character */</span>
<a name="2212" /><span class="True">    2212:</span>     <span class="b">Py_UCS4</span> <span class="f">*</span><span class="b">res</span>
<a name="2213" /><span class="True">    2213:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2214" /><span class="True">    2214:</span> 
<a name="2215" /><span class="True">    2215:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_ToFoldedFull</span><span class="f">(</span>
<a name="2216" /><span class="True">    2216:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span><span class="f">,</span>       <span class="k">/* Unicode character */</span>
<a name="2217" /><span class="True">    2217:</span>     <span class="b">Py_UCS4</span> <span class="f">*</span><span class="b">res</span>
<a name="2218" /><span class="True">    2218:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2219" /><span class="True">    2219:</span> 
<a name="2220" /><span class="True">    2220:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsCaseIgnorable</span><span class="f">(</span>
<a name="2221" /><span class="True">    2221:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>         <span class="k">/* Unicode character */</span>
<a name="2222" /><span class="True">    2222:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2223" /><span class="True">    2223:</span> 
<a name="2224" /><span class="True">    2224:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsCased</span><span class="f">(</span>
<a name="2225" /><span class="True">    2225:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>         <span class="k">/* Unicode character */</span>
<a name="2226" /><span class="True">    2226:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2227" /><span class="True">    2227:</span> 
<a name="2228" /><span class="True">    2228:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_ToDecimalDigit</span><span class="f">(</span>
<a name="2229" /><span class="True">    2229:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2230" /><span class="True">    2230:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2231" /><span class="True">    2231:</span> 
<a name="2232" /><span class="True">    2232:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_ToDigit</span><span class="f">(</span>
<a name="2233" /><span class="True">    2233:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2234" /><span class="True">    2234:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2235" /><span class="True">    2235:</span> 
<a name="2236" /><span class="True">    2236:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">double</span><span class="f">)</span> <span class="b">_PyUnicode_ToNumeric</span><span class="f">(</span>
<a name="2237" /><span class="True">    2237:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2238" /><span class="True">    2238:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2239" /><span class="True">    2239:</span> 
<a name="2240" /><span class="True">    2240:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsDecimalDigit</span><span class="f">(</span>
<a name="2241" /><span class="True">    2241:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2242" /><span class="True">    2242:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2243" /><span class="True">    2243:</span> 
<a name="2244" /><span class="True">    2244:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsDigit</span><span class="f">(</span>
<a name="2245" /><span class="True">    2245:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2246" /><span class="True">    2246:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2247" /><span class="True">    2247:</span> 
<a name="2248" /><span class="True">    2248:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsNumeric</span><span class="f">(</span>
<a name="2249" /><span class="True">    2249:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2250" /><span class="True">    2250:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2251" /><span class="True">    2251:</span> 
<a name="2252" /><span class="True">    2252:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsPrintable</span><span class="f">(</span>
<a name="2253" /><span class="True">    2253:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2254" /><span class="True">    2254:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2255" /><span class="True">    2255:</span> 
<a name="2256" /><span class="True">    2256:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_IsAlpha</span><span class="f">(</span>
<a name="2257" /><span class="True">    2257:</span>     <span class="b">Py_UCS4</span> <span class="b">ch</span>       <span class="k">/* Unicode character */</span>
<a name="2258" /><span class="True">    2258:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2259" /><span class="True">    2259:</span> 
<a name="2260" /><span class="True">    2260:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">size_t</span><span class="f">)</span> <span class="b">Py_UNICODE_strlen</span><span class="f">(</span>
<a name="2261" /><span class="True">    2261:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">u</span>
<a name="2262" /><span class="True">    2262:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2263" /><span class="True">    2263:</span> 
<a name="2264" /><span class="True">    2264:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UNICODE</span><span class="f">*</span><span class="f">)</span> <span class="b">Py_UNICODE_strcpy</span><span class="f">(</span>
<a name="2265" /><span class="True">    2265:</span>     <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s1</span><span class="f">,</span>
<a name="2266" /><span class="True">    2266:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s2</span><span class="f">)</span><span class="f">;</span>
<a name="2267" /><span class="True">    2267:</span> 
<a name="2268" /><span class="True">    2268:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UNICODE</span><span class="f">*</span><span class="f">)</span> <span class="b">Py_UNICODE_strcat</span><span class="f">(</span>
<a name="2269" /><span class="True">    2269:</span>     <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s1</span><span class="f">,</span> <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s2</span><span class="f">)</span><span class="f">;</span>
<a name="2270" /><span class="True">    2270:</span> 
<a name="2271" /><span class="True">    2271:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UNICODE</span><span class="f">*</span><span class="f">)</span> <span class="b">Py_UNICODE_strncpy</span><span class="f">(</span>
<a name="2272" /><span class="True">    2272:</span>     <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s1</span><span class="f">,</span>
<a name="2273" /><span class="True">    2273:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s2</span><span class="f">,</span>
<a name="2274" /><span class="True">    2274:</span>     <span class="b">size_t</span> <span class="b">n</span><span class="f">)</span><span class="f">;</span>
<a name="2275" /><span class="True">    2275:</span> 
<a name="2276" /><span class="True">    2276:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">Py_UNICODE_strcmp</span><span class="f">(</span>
<a name="2277" /><span class="True">    2277:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s1</span><span class="f">,</span>
<a name="2278" /><span class="True">    2278:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s2</span>
<a name="2279" /><span class="True">    2279:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2280" /><span class="True">    2280:</span> 
<a name="2281" /><span class="True">    2281:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">Py_UNICODE_strncmp</span><span class="f">(</span>
<a name="2282" /><span class="True">    2282:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s1</span><span class="f">,</span>
<a name="2283" /><span class="True">    2283:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s2</span><span class="f">,</span>
<a name="2284" /><span class="True">    2284:</span>     <span class="b">size_t</span> <span class="b">n</span>
<a name="2285" /><span class="True">    2285:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2286" /><span class="True">    2286:</span> 
<a name="2287" /><span class="True">    2287:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UNICODE</span><span class="f">*</span><span class="f">)</span> <span class="b">Py_UNICODE_strchr</span><span class="f">(</span>
<a name="2288" /><span class="True">    2288:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s</span><span class="f">,</span>
<a name="2289" /><span class="True">    2289:</span>     <span class="b">Py_UNICODE</span> <span class="b">c</span>
<a name="2290" /><span class="True">    2290:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2291" /><span class="True">    2291:</span> 
<a name="2292" /><span class="True">    2292:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UNICODE</span><span class="f">*</span><span class="f">)</span> <span class="b">Py_UNICODE_strrchr</span><span class="f">(</span>
<a name="2293" /><span class="True">    2293:</span>     <span class="m">const</span> <span class="b">Py_UNICODE</span> <span class="f">*</span><span class="b">s</span><span class="f">,</span>
<a name="2294" /><span class="True">    2294:</span>     <span class="b">Py_UNICODE</span> <span class="b">c</span>
<a name="2295" /><span class="True">    2295:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2296" /><span class="True">    2296:</span> 
<a name="2297" /><span class="True">    2297:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_FormatLong</span><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">,</span> <span class="m">int</span><span class="f">,</span> <span class="m">int</span><span class="f">,</span> <span class="m">int</span><span class="f">)</span><span class="f">;</span>
<a name="2298" /><span class="True">    2298:</span> 
<a name="2299" /><span class="True">    2299:</span> <span class="k">/* Create a copy of a unicode string ending with a nul character. Return NULL</span>
<a name="2300" /><span class="True">    2300:</span> <span class="k">   and raise a MemoryError exception on memory allocation failure, otherwise</span>
<a name="2301" /><span class="True">    2301:</span> <span class="k">   return a new allocated buffer (use PyMem_Free() to free the buffer). */</span>
<a name="2302" /><span class="True">    2302:</span> 
<a name="2303" /><span class="True">    2303:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">Py_UNICODE</span><span class="f">*</span><span class="f">)</span> <span class="b">PyUnicode_AsUnicodeCopy</span><span class="f">(</span>
<a name="2304" /><span class="True">    2304:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">unicode</span>
<a name="2305" /><span class="True">    2305:</span>     <span class="f">)</span><span class="f">;</span>
<a name="2306" /><span class="True">    2306:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* Py_LIMITED_API */</span>
<a name="2307" /><span class="True">    2307:</span> 
<a name="2308" /><span class="True">    2308:</span> <span class="f">#</span><span class="n">if</span> <span class="b">defined</span><span class="f">(</span><a href="macros_ref.html#_UHlfREVCVUdfMA__"><span class="b">Py_DEBUG</span></a><span class="f">)</span> <span class="f">&amp;&amp;</span> <span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">Py_LIMITED_API</span><span class="f">)</span>
<a name="2309" /><span class="True">    2309:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_CheckConsistency</span><span class="f">(</span>
<a name="2310" /><span class="True">    2310:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">op</span><span class="f">,</span>
<a name="2311" /><span class="True">    2311:</span>     <span class="m">int</span> <span class="b">check_content</span><span class="f">)</span><span class="f">;</span>
<a name="2312" /><span class="False">    2312:</span> <span class="f">#</span><span class="n">elif</span> <span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">NDEBUG</span><span class="f">)</span>
<a name="2313" /><span class="False">    2313:</span> <span class="k">/* For asserts that call _PyUnicode_CheckConsistency(), which would</span>
<a name="2314" /><span class="False">    2314:</span> <span class="k"> * otherwise be a problem when building with asserts but without Py_DEBUG. */</span>
<a name="2315" /><span class="False">    2315:</span> <span class="f">#</span><span class="n">define</span> <span class="b">_PyUnicode_CheckConsistency</span><span class="f">(</span><span class="b">op</span><span class="f">,</span> <span class="b">check_content</span><span class="f">)</span> <a href="macros_ref.html#_UHlVbmljb2RlX0NoZWNrXzA_"><span class="b">PyUnicode_Check</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span>
<a name="2316" /><span class="True">    2316:</span> <span class="f">#</span><span class="n">endif</span>
<a name="2317" /><span class="True">    2317:</span> 
<a name="2318" /><span class="True">    2318:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="2319" /><span class="True">    2319:</span> <span class="k">/* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/</span>
<a name="2320" /><span class="True">    2320:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span><span class="f">*</span><span class="f">)</span> <span class="b">_PyUnicode_FromId</span><span class="f">(</span><span class="b">_Py_Identifier</span><span class="f">*</span><span class="f">)</span><span class="f">;</span>
<a name="2321" /><span class="True">    2321:</span> <span class="k">/* Clear all static strings. */</span>
<a name="2322" /><span class="True">    2322:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">void</span><span class="f">)</span> <span class="b">_PyUnicode_ClearStaticStrings</span><span class="f">(</span><span class="m">void</span><span class="f">)</span><span class="f">;</span>
<a name="2323" /><span class="True">    2323:</span> 
<a name="2324" /><span class="True">    2324:</span> <span class="k">/* Fast equality check when the inputs are known to be exact unicode types</span>
<a name="2325" /><span class="True">    2325:</span> <span class="k">   and where the hash values are equal (i.e. a very probable match) */</span>
<a name="2326" /><span class="True">    2326:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="m">int</span><span class="f">)</span> <span class="b">_PyUnicode_EQ</span><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">,</span> <span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span><span class="f">;</span>
<a name="2327" /><span class="True">    2327:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* !Py_LIMITED_API */</span>
<a name="2328" /><span class="True">    2328:</span> 
<a name="2329" /><span class="False">    2329:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">__cplusplus</span>
<a name="2330" /><span class="False">    2330:</span> <span class="f">}</span>
<a name="2331" /><span class="True">    2331:</span> <span class="f">#</span><span class="n">endif</span>
<a name="2332" /><span class="True">    2332:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* !Py_UNICODEOBJECT_H */</span>
<a name="2333" /><span class="True">    2333:</span> </pre>
  </body>
</html>
